public class

GTKLookAndFeel

extends SynthLookAndFeel
java.lang.Object
   ↳ javax.swing.LookAndFeel
     ↳ javax.swing.plaf.basic.BasicLookAndFeel
       ↳ javax.swing.plaf.synth.SynthLookAndFeel
         ↳ com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Summary

Public Constructors
GTKLookAndFeel()
Public Methods
static ComponentUI createUI(JComponent c)
Creates the GTK look and feel class for the passed in Component.
UIDefaults getDefaults()
Returns the defaults for this SynthLookAndFeel.
String getDescription()
Returns a textual description of SynthLookAndFeel.
String getID()
Return a string that identifies this look and feel.
LayoutStyle getLayoutStyle()
Returns the LayoutStyle for this look and feel.
String getName()
Return a short string that identifies this look and feel.
void initialize()
Called by UIManager when this look and feel is installed.
boolean isNativeLookAndFeel()
Returns false, SynthLookAndFeel is not a native look and feel.
boolean isSupportedLookAndFeel()
Returns true, SynthLookAndFeel is always supported.
boolean shouldUpdateStyleOnAncestorChanged()
Returns whether or not the UIs should update their SynthStyles from the SynthStyleFactory when the ancestor of the Component changes.
Protected Methods
void initComponentDefaults(UIDefaults table)
Populates table with the defaults for the basic look and feel.
void initSystemColorDefaults(UIDefaults table)
Populates table with system colors.
void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)
Populates table with the name-color pairs in systemColors.
[Expand]
Inherited Methods
From class javax.swing.plaf.synth.SynthLookAndFeel
From class javax.swing.plaf.basic.BasicLookAndFeel
From class javax.swing.LookAndFeel
From class java.lang.Object

Public Constructors

public GTKLookAndFeel ()

Public Methods

public static ComponentUI createUI (JComponent c)

Creates the GTK look and feel class for the passed in Component.

public UIDefaults getDefaults ()

Returns the defaults for this SynthLookAndFeel.

Returns
  • Defaults table.

public String getDescription ()

Returns a textual description of SynthLookAndFeel.

Returns
  • textual description of synth.

public String getID ()

Return a string that identifies this look and feel.

Returns
  • a short string identifying this look and feel.

public LayoutStyle getLayoutStyle ()

Returns the LayoutStyle for this look and feel. This never returns null.

You generally don't use the LayoutStyle from the look and feel, instead use the LayoutStyle method getInstance.

Returns
  • the LayoutStyle for this look and feel

public String getName ()

Return a short string that identifies this look and feel.

Returns
  • a short string identifying this look and feel.

public void initialize ()

Called by UIManager when this look and feel is installed.

public boolean isNativeLookAndFeel ()

Returns false, SynthLookAndFeel is not a native look and feel.

Returns
  • false

public boolean isSupportedLookAndFeel ()

Returns true, SynthLookAndFeel is always supported.

Returns
  • true.

public boolean shouldUpdateStyleOnAncestorChanged ()

Returns whether or not the UIs should update their SynthStyles from the SynthStyleFactory when the ancestor of the Component changes.

Returns
  • whether or not the UIs should update their SynthStyles from the SynthStyleFactory when the ancestor changed.

Protected Methods

protected void initComponentDefaults (UIDefaults table)

Populates table with the defaults for the basic look and feel.

Parameters
table the UIDefaults to add the values to

protected void initSystemColorDefaults (UIDefaults table)

Populates table with system colors. This creates an array of name-color pairs and invokes loadSystemColors.

The name is a String that corresponds to the name of one of the static SystemColor fields in the SystemColor class. A name-color pair is created for every such SystemColor field.

The color corresponds to a hex String as understood by Color.decode. For example, one of the name-color pairs is "desktop"-"#005C5C". This corresponds to the SystemColor field desktop, with a color value of new Color(0x005C5C).

The following shows two of the name-color pairs:

   String[] nameColorPairs = new String[] {
          "desktop", "#005C5C",
    "activeCaption", "#000080" };
   loadSystemColors(table, nameColorPairs, isNativeLookAndFeel());
 
As previously stated, this invokes loadSystemColors with the supplied table and name-color pair array. The last argument to loadSystemColors indicates whether the value of the field in SystemColor should be used. This method passes the value of isNativeLookAndFeel() as the last argument to loadSystemColors.

Parameters
table the UIDefaults object the values are added to

protected void loadSystemColors (UIDefaults table, String[] systemColors, boolean useNative)

Populates table with the name-color pairs in systemColors. Refer to initSystemColorDefaults(UIDefaults) for details on the format of systemColors.

An entry is added to table for each of the name-color pairs in systemColors. The entry key is the name of the name-color pair.

The value of the entry corresponds to the color of the name-color pair. The value of the entry is calculated in one of two ways. With either approach the value is always a ColorUIResource.

If useNative is false, the color is created by using Color.decode to convert the String into a Color. If decode can not convert the String into a Color (NumberFormatException is thrown) then a ColorUIResource of black is used.

If useNative is true, the color is the value of the field in SystemColor with the same name as the name of the name-color pair. If the field is not valid, a ColorUIResource of black is used.

Parameters
table the UIDefaults object the values are added to
systemColors array of name-color pairs as described in initSystemColorDefaults(UIDefaults)
useNative whether the color is obtained from SystemColor or Color.decode