public class LookAndFeelList
extends java.lang.Object
LookAndFeel
s, can setup a LookAndFeel
when
asked. It's possible to add a LookAndFeelListener
to this list and
receive events whenever the LookAndFeel
changes.getDefaultList()
to get a list of LookAndFeel
sModifier and Type | Class and Description |
---|---|
static class |
LookAndFeelList.Info
Information about a
LookAndFeel . |
Modifier | Constructor and Description |
---|---|
protected |
LookAndFeelList()
Crates a new list and collects all available
LookAndFeel s. |
Modifier and Type | Method and Description |
---|---|
void |
add(LookAndFeelList.Info info)
Adds a new
LookAndFeel to the list. |
void |
addComponentCollector(ComponentCollector c)
Adds a set of root-
Component s to this list, the set of
roots will be used to find all JComponent s
which need to be updated when the LookAndFeel changes. |
void |
addLookAndFeelListener(LookAndFeelListener listener)
Adds a listener to this list, the listener will be notified
whenever the
LookAndFeel is changed. |
LookAndFeelList.Info |
get(int index)
Gets the index'th
LookAndFeel . |
LookAndFeelList.Info |
getDefault()
Gets information about the
LookAndFeel that is used when
the system can decide on its own. |
static LookAndFeelList |
getDefaultList()
Gets the global list of
LookAndFeel s |
LookAndFeelList.Info |
getFull(int index)
|
LookAndFeelList.Info |
getFull(java.lang.String key)
Gets the
LookAndFeel whose unique identifier is key . |
LookAndFeelList.Info |
getLookAndFeel()
Gets the
LookAndFeel which is currently used. |
LookAndFeelList.Info |
getSystem()
Gets information about the
LookAndFeel that imitates
the native look of the system. |
int |
indexOf(LookAndFeelList.Info info)
Gets the location of
info . |
int |
indexOfFull(LookAndFeelList.Info info)
|
void |
insert(int index,
LookAndFeelList.Info info)
Inserts a new
LookAndFeel into the list. |
boolean |
isAllowReadOnlyOnce()
Whether multiple calls to
read(DataInputStream) have
an effect or not. |
java.lang.String |
keyOfFull(LookAndFeelList.Info info)
Gets a unique identifier for
info . |
protected java.util.Collection<java.awt.Component> |
listComponents()
Creates a list containing all root-
Component s of this application,
the ComponentCollector s are used to build this list. |
protected LookAndFeelListener[] |
listeners()
Gets all
LookAndFeelListener that are known to this list. |
void |
read(java.io.DataInputStream in)
|
void |
readXML(XElement element)
|
void |
remove(int index)
Removes a
LookAndFeel from this list. |
void |
remove(LookAndFeelList.Info info)
Removes the
LookAndFeel at location index from
this list. |
void |
removeComponentCollector(ComponentCollector c)
Removes an earlier added set of roots.
|
void |
removeLookAndFeelListener(LookAndFeelListener listener)
Removes a listener from this list.
|
void |
setAllowReadOnlyOnce(boolean allowReadOnlyOnce)
Sets whether multiple calls to
read(DataInputStream) will
have an effect. |
void |
setDefault(LookAndFeelList.Info defaultInfo)
Sets the default-
LookAndFeel . |
static void |
setDefaultList(LookAndFeelList list)
Sets the default
LookAndFeelList . |
void |
setLookAndFeel(LookAndFeelList.Info lookAndFeel)
Exchanges the currently used
LookAndFeel . |
void |
setReadOnce(boolean read)
Sets whether this list has already read something once, or whether
it is fresh.
|
void |
setSystem(LookAndFeelList.Info systemInfo)
Sets the system-
LookAndFeel . |
int |
size()
Gets the number of
LookAndFeel s that are known to this list. |
void |
write(java.io.DataOutputStream out)
Writes which
LookAndFeel is currently used. |
void |
writeXML(XElement element)
Writes which
LookAndFeel is currently used. |
protected LookAndFeelList()
LookAndFeel
s.public static LookAndFeelList getDefaultList()
LookAndFeel
snull
public static void setDefaultList(LookAndFeelList list)
LookAndFeelList
.list
- the list, can be null
public boolean isAllowReadOnlyOnce()
read(DataInputStream)
have
an effect or not.true
if only the first read-call has an effect.public void setAllowReadOnlyOnce(boolean allowReadOnlyOnce)
read(DataInputStream)
will
have an effect.allowReadOnlyOnce
- true
if only the first
read will have an effect, false
if the LookAndFeel
can change every time read(DataInputStream)
is called.public void setReadOnce(boolean read)
read
- true
if at least one time one of the
read
methods was called, false
otherwise.public void addLookAndFeelListener(LookAndFeelListener listener)
LookAndFeel
is changed.listener
- the new listenerpublic void removeLookAndFeelListener(LookAndFeelListener listener)
listener
- the listener to removeprotected LookAndFeelListener[] listeners()
LookAndFeelListener
that are known to this list.public void addComponentCollector(ComponentCollector c)
Component
s to this list, the set of
roots will be used to find all JComponent
s
which need to be updated when the LookAndFeel
changes.c
- the new set of rootspublic void removeComponentCollector(ComponentCollector c)
c
- the rootspublic void add(LookAndFeelList.Info info)
LookAndFeel
to the list.info
- the new LookAndFeelpublic void insert(int index, LookAndFeelList.Info info)
LookAndFeel
into the list.index
- the location of the new LookAndFeelinfo
- the new LookAndFeelpublic int size()
LookAndFeel
s that are known to this list.public LookAndFeelList.Info get(int index)
LookAndFeel
.index
- the location of the LookAndFeelpublic int indexOf(LookAndFeelList.Info info)
info
.info
- a LookAndFeel
info
or -1public LookAndFeelList.Info getFull(int index)
LookAndFeel
, where 0 means the
default
, 1 the system
and
anything else the normal
, moved by 2 steps, LookAndFeels.index
- the location of the LookAndFeelpublic int indexOfFull(LookAndFeelList.Info info)
info
, where 0 means the
default
, 1 the system
and
anything else the normal
, moved by 2 steps, LookAndFeels.info
- the LookAndFeel to searchinfo
public LookAndFeelList.Info getFull(java.lang.String key)
LookAndFeel
whose unique identifier is key
.key
- the key to searchLookAndFeel
or null
if key
was not foundpublic java.lang.String keyOfFull(LookAndFeelList.Info info)
info
.info
- the item whose identifier is searchedinfo
public void remove(LookAndFeelList.Info info)
LookAndFeel
at location index
from
this list.info
- the LookAndFeel to removepublic void remove(int index)
LookAndFeel
from this list.index
- the location of the element to removepublic LookAndFeelList.Info getLookAndFeel()
LookAndFeel
which is currently used.public void setLookAndFeel(LookAndFeelList.Info lookAndFeel)
LookAndFeel
.lookAndFeel
- information about a LookAndFeel
, not null
public LookAndFeelList.Info getDefault()
LookAndFeel
that is used when
the system can decide on its own.LookAndFeel
public void setDefault(LookAndFeelList.Info defaultInfo)
LookAndFeel
. Please note that getDefault()
will return another LookAndFeelList.Info
, even if the behavior of that other
info is the same as defaultInfo
.defaultInfo
- the default LookAndFeelpublic LookAndFeelList.Info getSystem()
LookAndFeel
that imitates
the native look of the system.LookAndFeel
public void setSystem(LookAndFeelList.Info systemInfo)
LookAndFeel
. Please note that getSystem()
will return another LookAndFeelList.Info
, even if the behavior of that other
info is the same as systemInfo
.systemInfo
- the system LookAndFeelpublic void write(java.io.DataOutputStream out) throws java.io.IOException
LookAndFeel
is currently used.out
- the stream to write intojava.io.IOException
- if the method can't write into out
public void read(java.io.DataInputStream in) throws java.io.IOException
in
- the stream to read fromjava.io.IOException
- if in
can't be readpublic void writeXML(XElement element)
LookAndFeel
is currently used.element
- the element to write into, the attributes of
element
will not be changed.public void readXML(XElement element)
element
- the element to read fromprotected java.util.Collection<java.awt.Component> listComponents()
Component
s of this application,
the ComponentCollector
s are used to build this list.