Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.plaf
Class LookAndFeelAddons

    java.lang.Object
      org.jdesktop.swingx.plaf.LookAndFeelAddons

Direct Known Subclasses:
  BasicLookAndFeelAddons

    public abstract class LookAndFeelAddons

extends java.lang.Object

Provides additional pluggable UI for new components added by the library. By default, the library uses the pluggable UI returned by `getBestMatchAddonClassName()`.

The default addon can be configured using the `swing.addon` system property as follow:

- on the command line, `java -Dswing.addon=ADDONCLASSNAME ...`
- at runtime and before using the library components `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");`.

Author:
  Frederic Lavigne, Karl Schaefer

Constructor Summary
`LookAndFeelAddons()`

Method Summary
`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(LookAndFeelAddons addon)`
`static void` | `setAddon(java.lang.String addonClassName)`
`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)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LookAndFeelAddons

    public LookAndFeelAddons()

Method Detail

### initialize

    public void initialize()

### uninitialize

    public void uninitialize()

### loadDefaults

    public void loadDefaults(java.lang.Object[] keysAndValues)

  Adds the given defaults in UIManager. Note: the values are added only if they do not exist in the existing look and feel defaults. This makes it possible for look and feel implementors to override SwingX defaults. Note: the array is traversed in reverse order. If a key is found twice in the array, the key/value with the highest position in the array gets precedence over the other key in the array

  Parameters:
    `keysAndValues` -

### unloadDefaults

    public void unloadDefaults(java.lang.Object[] keysAndValues)

### setAddon

    public static void setAddon(java.lang.String addonClassName)
                         throws java.lang.InstantiationException,
                                java.lang.IllegalAccessException,
                                java.lang.ClassNotFoundException

  Throws:
    `java.lang.InstantiationException`
    `java.lang.IllegalAccessException`
    `java.lang.ClassNotFoundException`

### setAddon

    public static void setAddon(java.lang.Class<?> addonClass)
                         throws java.lang.InstantiationException,
                                java.lang.IllegalAccessException

  Throws:
    `java.lang.InstantiationException`
    `java.lang.IllegalAccessException`

### setAddon

    public static void setAddon(LookAndFeelAddons addon)

### getAddon

    public static LookAndFeelAddons getAddon()

### getBestMatchAddonClassName

    public 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.

  Returns:
    the addon matching the currently installed look and feel

### getSystemAddonClassName

    public static java.lang.String getSystemAddonClassName()

  Gets the addon best suited for the operating system where the virtual machine is running.

  Returns:
    the addon matching the native operating system platform.

### contribute

    public static void contribute(ComponentAddon component)

  Each new component added by the library will contribute its default UI classes, colors and fonts to the LookAndFeelAddons. See `ComponentAddon`.

  Parameters:
    `component` -

### uncontribute

    public static void uncontribute(ComponentAddon component)

  Removes the contribution of the given addon

  Parameters:
    `component` -

### getUI

    public static javax.swing.plaf.ComponentUI getUI(javax.swing.JComponent component,
                                                     java.lang.Class<?> expectedUIClass)

  Workaround for IDE mixing up with classloaders and Applets environments. Consider this method as API private. It must not be called directly.

  Parameters:
    `component` -
    `expectedUIClass` -
  Returns:
    an instance of expectedUIClass

### setTrackingLookAndFeelChanges

    public 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.

  Parameters:
    `tracking` - true to automatically update the addon, false to not automatically track the addon. Defaults to false.
  See Also:
    `getBestMatchAddonClassName()`

### isTrackingLookAndFeelChanges

    public static boolean isTrackingLookAndFeelChanges()

  Returns:
    true if the addon will be automatically change to match the current look and feel
  See Also:
    `setTrackingLookAndFeelChanges(boolean)`

### installBackgroundPainter

    public 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. The painter is only set if the painter is `null` or an instance of `UIResource`.

  Parameters:
    `c` - component to set the painter on
    `painter` - key specifying the painter
  Throws:
    `java.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 set

### uninstallBackgroundPainter

    public static void uninstallBackgroundPainter(javax.swing.JComponent c)

  Convenience method for uninstalling a background painter. If the painter of the component is a `UIResource`, it is set to `null`.

  Parameters:
    `c` - component to uninstall the painter on
  Throws:
    `java.lang.NullPointerException` - if `c` is `null`
    `java.lang.IllegalArgumentException` - if the component does not contain the "backgroundPainter" property or the property cannot be set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.