APIdia Launch Partner
Top Inners Fields Constructors Methods
com.sun.java.swing.plaf.gtk

public Class GTKLookAndFeel

extends SynthLookAndFeel
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.awt.Color, .Component, .Container, .Dimension, .Font, .Insets, .KeyboardFocusManager, .Toolkit, .Window, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.lang.ref.ReferenceQueue, .WeakReference, java.util.HashMap, .Map, javax.swing.JComponent, .JTextField, .LayoutStyle, .SwingConstants, .SwingUtilities, .UIDefaults, .UIManager, javax.swing.colorchooser.AbstractColorChooserPanel, javax.swing.plaf.BorderUIResource, .ColorUIResource, .ComponentUI, .DimensionUIResource, .InsetsUIResource, javax.swing.plaf.synth.Region, .SynthConstants, .SynthLookAndFeel, .SynthStyleFactory, javax.swing.text.DefaultEditorKit, com.sun.java.swing.plaf.gtk.GTKConstants.PositionType, .GTKConstants.StateType, sun.awt.SunToolkit, .UNIXToolkit, sun.swing.AltProcessor, .DefaultLayoutStyle, .MnemonicHandler, .SwingAccessor, .SwingUtilities2

Author
Scott Violet

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static Map<Object, Object>
aaTextInfo

Whether or not text is drawn antialiased.

private Font
fallbackFont

Font to use in places where there is no widget.

private static boolean
private static String
gtkThemeName

Cached theme name.

private boolean
inInitialize

If true, GTKLookAndFeel is inside the initialize method.

private static boolean
private boolean
pclInstalled

If true, PropertyChangeListeners have been installed for the Toolkit.

pack-priv static ReferenceQueue<GTKLookAndFeel>
private GTKStyleFactory
styleFactory

StyleFactory needs to be created only the first time.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private native boolean
private boolean
configIconSizes(String sizeString)

public static ComponentUI
createUI(JComponent c)

Hides javax.swing.plaf.synth.SynthLookAndFeel.createUI.

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

private static void
public UIDefaults
getDefaults()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getDefaults.

Returns the defaults for this SynthLookAndFeel.

public String
getDescription()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getDescription.

Returns a textual description of SynthLookAndFeel.

private GTKStyleFactory
pack-priv static String
getGtkThemeName()

Returns the cached gtkThemeName

public String
getID()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getID.

Return a string that identifies this look and feel.

public LayoutStyle
getLayoutStyle()

Overrides javax.swing.LookAndFeel.getLayoutStyle.

Returns the LayoutStyle for this look and feel.

public String
getName()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getName.

Return a short string that identifies this look and feel.

protected void
initComponentDefaults(UIDefaults table)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults.

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

public void
initialize()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.initialize.

Called by UIManager when this look and feel is installed.

private void
initResourceBundle(UIDefaults table)

Hides javax.swing.plaf.basic.BasicLookAndFeel.initResourceBundle.

Initialize the defaults table with the name of the ResourceBundle used for getting localized defaults.

protected void
private void
pack-priv static boolean
is3()

pack-priv static boolean
public boolean
isNativeLookAndFeel()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.isNativeLookAndFeel.

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

public boolean
isSupportedLookAndFeel()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.isSupportedLookAndFeel.

Returns true, SynthLookAndFeel is always supported.

pack-priv static boolean
isText(Region region)

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

Overrides javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors.

Populates table with the name-color pairs in systemColors.

public boolean

Returns:

whether or not the UIs should update their SynthStyles from the SynthStyleFactory when the ancestor changed.
shouldUpdateStyleOnAncestorChanged
()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.shouldUpdateStyleOnAncestorChanged.

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

pack-priv static GTKConstants.PositionType
SwingOrientationConstantToGTK(int side)

Maps a swing constant to a GTK constant.

pack-priv static int
synthStateToGTKState(Region region, int state)

Maps from a Synth state to the corresponding GTK state.

pack-priv static GTKConstants.StateType
synthStateToGTKStateType(int state)

Maps from Synth state to native GTK state using typesafe enumeration StateType.

public void
uninitialize()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.uninitialize.

Called by UIManager when this look and feel is uninstalled.

Inherited from javax.swing.plaf.synth.SynthLookAndFeel:
getRegiongetStylegetStyleFactoryloadsetStyleFactoryshouldUpdateStyleOnEventupdateStyles

Field Detail

aaTextInfoback to summary
pack-priv static Map<Object, Object> aaTextInfo

Whether or not text is drawn antialiased. This keys off the desktop property 'gnome.Xft/Antialias' and 'gnome.Xft/RGBA' We should assume ON - or some variation of ON as no GTK desktop ships with it OFF.

fallbackFontback to summary
private Font fallbackFont

Font to use in places where there is no widget.

gtkAAFontSettingsCondback to summary
private static boolean gtkAAFontSettingsCond
gtkThemeNameback to summary
private static String gtkThemeName

Cached theme name. Used by GTKGraphicsUtils

inInitializeback to summary
private boolean inInitialize

If true, GTKLookAndFeel is inside the initialize method.

IS_3back to summary
private static boolean IS_3
pclInstalledback to summary
private boolean pclInstalled

If true, PropertyChangeListeners have been installed for the Toolkit.

queueback to summary
pack-priv static ReferenceQueue<GTKLookAndFeel> queue

Hides javax.swing.plaf.synth.SynthLookAndFeel.queue.

styleFactoryback to summary
private GTKStyleFactory styleFactory

StyleFactory needs to be created only the first time.

Constructor Detail

GTKLookAndFeelback to summary
public GTKLookAndFeel()

Method Detail

applyThemeIfNeededback to summary
private native boolean applyThemeIfNeeded()
configIconSizesback to summary
private boolean configIconSizes(String sizeString)
createUIback to summary
public static ComponentUI createUI(JComponent c)

Hides javax.swing.plaf.synth.SynthLookAndFeel.createUI.

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

flushUnreferencedback to summary
private static void flushUnreferenced()

Hides javax.swing.plaf.synth.SynthLookAndFeel.flushUnreferenced.

getDefaultsback to summary
public UIDefaults getDefaults()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getDefaults.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.getDefaults.

Returns the defaults for this SynthLookAndFeel.

Annotations
@Override
getDescriptionback to summary
public String getDescription()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getDescription.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.getDescription.

Returns a textual description of SynthLookAndFeel.

Annotations
@Override
getGTKStyleFactoryback to summary
private GTKStyleFactory getGTKStyleFactory()
getGtkThemeNameback to summary
pack-priv static String getGtkThemeName()

Returns the cached gtkThemeName

getIDback to summary
public String getID()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getID.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.getID.

Return a string that identifies this look and feel.

Annotations
@Override
getLayoutStyleback to summary
public LayoutStyle getLayoutStyle()

Overrides javax.swing.LookAndFeel.getLayoutStyle.

Doc from javax.swing.LookAndFeel.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.

Annotations
@Override
getNameback to summary
public String getName()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.getName.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.getName.

Return a short string that identifies this look and feel.

Annotations
@Override
initComponentDefaultsback to summary
protected void initComponentDefaults(UIDefaults table)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults.

Doc from javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults.

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

Annotations
@Override
initializeback to summary
public void initialize()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.initialize.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.initialize.

Called by UIManager when this look and feel is installed.

Annotations
@Override
initResourceBundleback to summary
private void initResourceBundle(UIDefaults table)

Hides javax.swing.plaf.basic.BasicLookAndFeel.initResourceBundle.

Doc from javax.swing.plaf.basic.BasicLookAndFeel.initResourceBundle.

Initialize the defaults table with the name of the ResourceBundle used for getting localized defaults. Also initialize the default locale used when no locale is passed into UIDefaults.get(). The default locale should generally not be relied upon. It is here for compatibility with releases prior to 1.4.

initSystemColorDefaultsback to summary
protected void initSystemColorDefaults(UIDefaults table)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initSystemColorDefaults.

Doc from javax.swing.plaf.basic.BasicLookAndFeel.initSystemColorDefaults.

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.
Annotations
@Override
installPropertyChangeListenersback to summary
private void installPropertyChangeListeners()
is3back to summary
pack-priv static boolean is3()
isLeftToRightback to summary
pack-priv static boolean isLeftToRight(Component c)

Hides javax.swing.plaf.synth.SynthLookAndFeel.isLeftToRight.

isNativeLookAndFeelback to summary
public boolean isNativeLookAndFeel()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.isNativeLookAndFeel.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.isNativeLookAndFeel.

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

Annotations
@Override
isSupportedLookAndFeelback to summary
public boolean isSupportedLookAndFeel()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.isSupportedLookAndFeel.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.isSupportedLookAndFeel.

Returns true, SynthLookAndFeel is always supported.

Annotations
@Override
isTextback to summary
pack-priv static boolean isText(Region region)
loadStylesback to summary
private void loadStyles()
loadSystemColorsback to summary
protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors.

Doc from javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors.

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.

Annotations
@Override
shouldUpdateStyleOnAncestorChangedback to summary
public boolean shouldUpdateStyleOnAncestorChanged()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.shouldUpdateStyleOnAncestorChanged.

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

Returns:boolean

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

Annotations
@Override
SwingOrientationConstantToGTKback to summary
pack-priv static GTKConstants.PositionType SwingOrientationConstantToGTK(int side)

Maps a swing constant to a GTK constant.

synthStateToGTKStateback to summary
pack-priv static int synthStateToGTKState(Region region, int state)

Maps from a Synth state to the corresponding GTK state. The GTK states are named differently than Synth's states, the following gives the mapping:

SynthGTK
SynthConstants.PRESSEDACTIVE
SynthConstants.SELECTEDSELECTED
SynthConstants.MOUSE_OVERPRELIGHT
SynthConstants.DISABLEDINSENSITIVE
SynthConstants.ENABLEDNORMAL
Additionally some widgets are special cased.
synthStateToGTKStateTypeback to summary
pack-priv static GTKConstants.StateType synthStateToGTKStateType(int state)

Maps from Synth state to native GTK state using typesafe enumeration StateType. This is only used by GTKEngine.

uninitializeback to summary
public void uninitialize()

Overrides javax.swing.plaf.synth.SynthLookAndFeel.uninitialize.

Doc from javax.swing.plaf.synth.SynthLookAndFeel.uninitialize.

Called by UIManager when this look and feel is uninstalled.

Annotations
@Override
com.sun.java.swing.plaf.gtk back to summary

private Class GTKLookAndFeel.GnomeLayoutStyle

extends DefaultLayoutStyle
Class Inheritance
Annotations
@SuppressWarnings:fallthrough

Gnome layout style. From: http://developer.gnome.org/projects/gup/hig/2.0/design-window.html#window-layout-spacing You'll notice this doesn't do the radiobutton/checkbox border adjustments that windows/metal do. This is because gtk doesn't provide margins/insets for checkbox/radiobuttons.

Field Summary

Modifier and TypeField and Description
private static GTKLookAndFeel.GnomeLayoutStyle

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
getContainerGap(JComponent component, int position, Container parent)

Overrides sun.swing.DefaultLayoutStyle.getContainerGap.

Returns the amount of space to place between the component and specified edge of its parent.

public int
getPreferredGap(JComponent component1, JComponent component2, LayoutStyle.ComponentPlacement type, int position, Container parent)

Overrides sun.swing.DefaultLayoutStyle.getPreferredGap.

Returns the amount of space to use between two components.

Inherited from sun.swing.DefaultLayoutStyle:
flipDirectiongetButtonGapgetButtonGapgetButtonGapgetIndentgetInstanceisLabelAndNonlabel

Field Detail

INSTANCEback to summary
private static GTKLookAndFeel.GnomeLayoutStyle INSTANCE

Hides sun.swing.DefaultLayoutStyle.INSTANCE.

Constructor Detail

GnomeLayoutStyleback to summary
private GnomeLayoutStyle()

Method Detail

getContainerGapback to summary
public int getContainerGap(JComponent component, int position, Container parent)

Overrides sun.swing.DefaultLayoutStyle.getContainerGap.

Doc from javax.swing.LayoutStyle.getContainerGap.

Returns the amount of space to place between the component and specified edge of its parent.

Annotations
@Override
getPreferredGapback to summary
public int getPreferredGap(JComponent component1, JComponent component2, LayoutStyle.ComponentPlacement type, int position, Container parent)

Overrides sun.swing.DefaultLayoutStyle.getPreferredGap.

Doc from javax.swing.LayoutStyle.getPreferredGap.

Returns the amount of space to use between two components. The return value indicates the distance to place component2 relative to component1. For example, the following returns the amount of space to place between component2 and component1 when component2 is placed vertically above component1:

  int gap = getPreferredGap(component1, component2,
                            ComponentPlacement.RELATED,
                            SwingConstants.NORTH, parent);
The type parameter indicates the relation between the two components. If the two components will be contained in the same parent and are showing similar logically related items, use RELATED. If the two components will be contained in the same parent but show logically unrelated items use UNRELATED. Some look and feels may not distinguish between the RELATED and UNRELATED types.

The return value is not intended to take into account the current size and position of component2 or component1. The return value may take into consideration various properties of the components. For example, the space may vary based on font size, or the preferred size of the component.

Annotations
@Override
com.sun.java.swing.plaf.gtk back to summary

pack-priv Class GTKLookAndFeel.WeakPCL

extends WeakReference<GTKLookAndFeel>
implements PropertyChangeListener
Class Inheritance
All Implemented Interfaces
java.beans.PropertyChangeListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private String
private Toolkit

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public String
public void
propertyChange(final PropertyChangeEvent pce)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Field Detail

keyback to summary
private String key
kitback to summary
private Toolkit kit

Constructor Detail

WeakPCLback to summary
pack-priv WeakPCL(GTKLookAndFeel target, Toolkit kit, String key)

Method Detail

disposeback to summary
pack-priv void dispose()
getKeyback to summary
public String getKey()
propertyChangeback to summary
public void propertyChange(final PropertyChangeEvent pce)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Annotations
@Override