BasicLookAndFeelAddons
public abstract class LookAndFeelAddons
extends java.lang.Object
getBestMatchAddonClassName()
.
The default addon can be configured using the
swing.addon
system property as follow:
java -Dswing.addon=ADDONCLASSNAME ...
System.getProperties().put("swing.addon", ADDONCLASSNAME);
The addon can also be installed directly by calling the
setAddon(String)
method. For example, to install the
Windows addons, add the following statement
LookAndFeelAddons.setAddon("org.jdesktop.swingx.plaf.windows.WindowsLookAndFeelAddons");
.
Constructor | Description |
---|---|
LookAndFeelAddons() |
Modifier and Type | Method | Description |
---|---|---|
static void |
contribute(ComponentAddon component) |
Each new component added by the library will contribute its
default UI classes, colors and fonts to the LookAndFeelAddons.
|
static LookAndFeelAddons |
getAddon() |
|
static java.lang.String |
getBestMatchAddonClassName() |
Based on the current look and feel (as returned by
UIManager.getLookAndFeel() ), this method returns
the name of the closest LookAndFeelAddons to use. |
static java.lang.String |
getSystemAddonClassName() |
Gets the addon best suited for the operating system where the
virtual machine is running.
|
static javax.swing.plaf.ComponentUI |
getUI(javax.swing.JComponent component,
java.lang.Class<?> expectedUIClass) |
Workaround for IDE mixing up with classloaders and Applets environments.
|
void |
initialize() |
|
static void |
installBackgroundPainter(javax.swing.JComponent c,
java.lang.String painter) |
Convenience method for setting a component's background painter property
with a value from the defaults.
|
static boolean |
isTrackingLookAndFeelChanges() |
|
void |
loadDefaults(java.lang.Object[] keysAndValues) |
Adds the given defaults in UIManager.
|
static void |
setAddon(java.lang.Class<?> addonClass) |
|
static void |
setAddon(java.lang.String addonClassName) |
|
static void |
setAddon(LookAndFeelAddons addon) |
|
static void |
setTrackingLookAndFeelChanges(boolean tracking) |
If true, everytime the Swing look and feel is changed, the addon which
best matches the current look and feel will be automatically selected.
|
static void |
uncontribute(ComponentAddon component) |
Removes the contribution of the given addon
|
void |
uninitialize() |
|
static void |
uninstallBackgroundPainter(javax.swing.JComponent c) |
Convenience method for uninstalling a background painter.
|
void |
unloadDefaults(java.lang.Object[] keysAndValues) |
public void initialize()
public void uninitialize()
public void loadDefaults(java.lang.Object[] keysAndValues)
keysAndValues
- public void unloadDefaults(java.lang.Object[] keysAndValues)
public static void setAddon(java.lang.String addonClassName) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static void setAddon(java.lang.Class<?> addonClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public static void setAddon(LookAndFeelAddons addon)
public static LookAndFeelAddons getAddon()
public static java.lang.String getBestMatchAddonClassName()
UIManager.getLookAndFeel()
), this method returns
the name of the closest LookAndFeelAddons
to use.public static java.lang.String getSystemAddonClassName()
public static void contribute(ComponentAddon component)
ComponentAddon
.component
- public static void uncontribute(ComponentAddon component)
component
- public static javax.swing.plaf.ComponentUI getUI(javax.swing.JComponent component, java.lang.Class<?> expectedUIClass)
component
- expectedUIClass
- public static void setTrackingLookAndFeelChanges(boolean tracking)
tracking
- true to automatically update the addon, false to not automatically
track the addon. Defaults to false.getBestMatchAddonClassName()
public static boolean isTrackingLookAndFeelChanges()
setTrackingLookAndFeelChanges(boolean)
public static void installBackgroundPainter(javax.swing.JComponent c, java.lang.String painter)
null
or an instance of UIResource
.c
- component to set the painter onpainter
- key specifying the painterjava.lang.NullPointerException
- if the component or painter is null
java.lang.IllegalArgumentException
- if the component does not contain the "backgroundPainter"
property or the property cannot be setpublic static void uninstallBackgroundPainter(javax.swing.JComponent c)
UIResource
, it is set to null
.c
- component to uninstall the painter onjava.lang.NullPointerException
- if c
is null
java.lang.IllegalArgumentException
- if the component does not contain the "backgroundPainter"
property or the property cannot be set