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

pack-priv Class GTKStyle

extends SynthStyle
implements GTKConstants
Class Inheritance
All Implemented Interfaces
com.sun.java.swing.plaf.gtk.GTKConstants
Imports
java.awt.*, java.lang.reflect.*, java.util.*, javax.swing.*, javax.swing.plaf.*, javax.swing.plaf.synth.*, .SynthIcon, sun.awt.UNIXToolkit, sun.swing.SwingUtilities2, com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType

Author
Scott Violet

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
GTKStyle.GTKLazyValue

GTKLazyValue is a slimmed down version of ProxyLazyValue.

private static class
GTKStyle.GTKStockIcon

An Icon that is fetched using getStockIcon.

pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final Color
pack-priv static final Insets
private static final Map<String, String>
CLASS_SPECIFIC_MAP

Maps from a key that is passed to Style.get to the equivalent class specific key.

pack-priv static final Font
private final Font
font

The font used for this particular style, as determined at construction time.

private static final GTKGraphicsUtils
private static final String
private static final Map<String, GTKStyle.GTKStockIcon>
ICONS_MAP

Backing style properties that are used if the style does not defined the property.

pack-priv static final Color
private final int
widgetType

Widget type used when looking up class specific values.

private final int
xThickness

The x/y thickness values for this particular style.

private final int
yThickness

The x/y thickness values for this particular style.

Constructor Summary

AccessConstructor and Description
pack-priv
GTKStyle(Font userFont, GTKEngine.WidgetType widgetType)

Method Summary

Modifier and TypeMethod and Description
public Object
get(SynthContext context, Object key)

Overrides javax.swing.plaf.synth.SynthStyle.get.

Getter for a region specific style property.

private Insets
pack-priv boolean

Returns:

Value, or defaultValue if key is not defined
getClassSpecificBoolValue
(SynthContext
SynthContext identifying requestor
context
,
String
Key identifying class specific value
key
,
boolean
Returned if there is no value for the specified type
defaultValue
)

Convenience method to get a class specific Boolean value.

pack-priv Insets

Returns:

Value, or defaultValue if key is not defined
getClassSpecificInsetsValue
(SynthContext
SynthContext identifying requestor
context
,
String
Key identifying class specific value
key
,
Insets
Returned if there is no value for the specified type
defaultValue
)

Convenience method to get a class specific Insets value.

private static int

Returns:

Value, or defaultValue if key is not defined
getClassSpecificIntValue
(GTKEngine.WidgetType
WidgetType for which to fetch the value
wt
,
String
Key identifying class specific value
key
,
int
Returned if there is no value for the specified type
defaultValue
)

Convenience method to get a class specific integer value for a particular WidgetType.

pack-priv int

Returns:

Value, or defaultValue if key is not defined
getClassSpecificIntValue
(SynthContext
SynthContext identifying requestor
context
,
String
Key identifying class specific value
key
,
int
Returned if there is no value for the specified type
defaultValue
)

Convenience method to get a class specific integer value.

private static Object

Returns:

Value, or null if one has not been defined
getClassSpecificValue
(GTKEngine.WidgetType
WidgetType for which to fetch the value
wt
,
String
Key identifying class specific value
key
)

Returns the value for a class specific property for a particular WidgetType.

pack-priv Object

Returns:

Value, or null if one has not been defined.
getClassSpecificValue
(String
Key identifying class specific value
key
)

Returns the value for a class specific property.

public Color
getColor(SynthContext context, ColorType type)

Overrides javax.swing.plaf.synth.SynthStyle.getColor.

Returns the color for the specified state.

protected Color
getColorForState(SynthContext context, ColorType type)

Implements abstract javax.swing.plaf.synth.SynthStyle.getColorForState.

Returns the color for the specified state.

pack-priv Font
protected Font
getFontForState(SynthContext context)

Implements abstract javax.swing.plaf.synth.SynthStyle.getFontForState.

Returns the font for the specified state.

public SynthGraphicsUtils
getGraphicsUtils(SynthContext context)

Overrides javax.swing.plaf.synth.SynthStyle.getGraphicsUtils.

Returns the SynthGraphicUtils for the specified context.

pack-priv Color
getGTKColor(int state, ColorType type)

pack-priv Color
getGTKColor(int widgetType, int state, int colorType)

pack-priv Color

Returns:

Color to render with
getGTKColor
(SynthContext
SynthContext identifying requestor
context
,
int
to get the color for
state
,
ColorType
of the color
type
)

Returns the color for the specified state.

public Insets

Returns:

Insets.
getInsets
(SynthContext
SynthContext identifying requestor
state
,
Insets
Where to place Insets
insets
)

Overrides javax.swing.plaf.synth.SynthStyle.getInsets.

Returns the Insets.

private Insets
private Insets
public SynthPainter

Returns:

SynthPainter
getPainter
(SynthContext
SynthContext identifying requestor
state
)

Overrides javax.swing.plaf.synth.SynthStyle.getPainter.

Returns a SynthPainter that will route the appropriate calls to a GTKEngine.

private Insets
private Insets
private Insets
private Insets
getSimpleInsets(SynthContext context, Insets insets, int n)

private Insets
private Icon
getStockIcon(SynthContext context, String key, int type)

private Color
getStyleSpecificColor(SynthContext context, int state, ColorType type)

Returns color specific to the current style.

private Icon
private Insets
private Insets
private Insets
pack-priv int

Returns:

x thickness.
getXThickness
()

Returns the X thickness to use for this GTKStyle.

pack-priv int

Returns:

y thickness.
getYThickness
()

Returns the Y thickness to use for this GTKStyle.

public void
installDefaults(SynthContext context)

Overrides javax.swing.plaf.synth.SynthStyle.installDefaults.

Installs the necessary state from this Style on the JComponent from context.

public boolean

Returns:

opaque Whether or not the JComponent is opaque.
isOpaque
(SynthContext
SynthContext identifying requestor
context
)

Overrides javax.swing.plaf.synth.SynthStyle.isOpaque.

Returns the value to initialize the opacity property of the Component to.

private static native Object
nativeGetClassValue(int widgetType, String key)

private static native int
nativeGetColorForState(int widgetType, int state, int typeID)

private static native String
nativeGetPangoFontName(int widgetType)

private static native int
nativeGetXThickness(int widgetType)

private static native int
nativeGetYThickness(int widgetType)

Inherited from javax.swing.plaf.synth.SynthStyle:
getBooleangetFontgetIcongetIntgetStringuninstallDefaults

Field Detail

BLACK_COLORback to summary
pack-priv static final Color BLACK_COLOR
BUTTON_DEFAULT_BORDER_INSETSback to summary
pack-priv static final Insets BUTTON_DEFAULT_BORDER_INSETS
CLASS_SPECIFIC_MAPback to summary
private static final Map<String, String> CLASS_SPECIFIC_MAP

Maps from a key that is passed to Style.get to the equivalent class specific key.

DEFAULT_FONTback to summary
pack-priv static final Font DEFAULT_FONT
fontback to summary
private final Font font

The font used for this particular style, as determined at construction time.

GTK_GRAPHICSback to summary
private static final GTKGraphicsUtils GTK_GRAPHICS
ICON_PROPERTY_PREFIXback to summary
private static final String ICON_PROPERTY_PREFIX
ICONS_MAPback to summary
private static final Map<String, GTKStyle.GTKStockIcon> ICONS_MAP

Backing style properties that are used if the style does not defined the property.

WHITE_COLORback to summary
pack-priv static final Color WHITE_COLOR
widgetTypeback to summary
private final int widgetType

Widget type used when looking up class specific values.

xThicknessback to summary
private final int xThickness

The x/y thickness values for this particular style.

yThicknessback to summary
private final int yThickness

The x/y thickness values for this particular style.

Constructor Detail

GTKStyleback to summary
pack-priv GTKStyle(Font userFont, GTKEngine.WidgetType widgetType)

Method Detail

getback to summary
public Object get(SynthContext context, Object key)

Overrides javax.swing.plaf.synth.SynthStyle.get.

Doc from javax.swing.plaf.synth.SynthStyle.get.

Getter for a region specific style property.

Annotations
@Override
getButtonInsetsback to summary
private Insets getButtonInsets(SynthContext context, Insets insets)
getClassSpecificBoolValueback to summary
pack-priv boolean getClassSpecificBoolValue(SynthContext context, String key, boolean defaultValue)

Convenience method to get a class specific Boolean value.

Parameters
context:SynthContext

SynthContext identifying requestor

key:String

Key identifying class specific value

defaultValue:boolean

Returned if there is no value for the specified type

Returns:boolean

Value, or defaultValue if key is not defined

getClassSpecificInsetsValueback to summary
pack-priv Insets getClassSpecificInsetsValue(SynthContext context, String key, Insets defaultValue)

Convenience method to get a class specific Insets value.

Parameters
context:SynthContext

SynthContext identifying requestor

key:String

Key identifying class specific value

defaultValue:Insets

Returned if there is no value for the specified type

Returns:Insets

Value, or defaultValue if key is not defined

getClassSpecificIntValueback to summary
private static int getClassSpecificIntValue(GTKEngine.WidgetType wt, String key, int defaultValue)

Convenience method to get a class specific integer value for a particular WidgetType.

Parameters
wt:GTKEngine.WidgetType

WidgetType for which to fetch the value

key:String

Key identifying class specific value

defaultValue:int

Returned if there is no value for the specified type

Returns:int

Value, or defaultValue if key is not defined

getClassSpecificIntValueback to summary
pack-priv int getClassSpecificIntValue(SynthContext context, String key, int defaultValue)

Convenience method to get a class specific integer value.

Parameters
context:SynthContext

SynthContext identifying requestor

key:String

Key identifying class specific value

defaultValue:int

Returned if there is no value for the specified type

Returns:int

Value, or defaultValue if key is not defined

getClassSpecificValueback to summary
private static Object getClassSpecificValue(GTKEngine.WidgetType wt, String key)

Returns the value for a class specific property for a particular WidgetType. This method is useful in those cases where we need to fetch a value for a Region that is not associated with the component currently in use (e.g. we need to figure out the insets for a SCROLL_BAR, but certain values can only be extracted from a SCROLL_PANE region).

Parameters
wt:GTKEngine.WidgetType

WidgetType for which to fetch the value

key:String

Key identifying class specific value

Returns:Object

Value, or null if one has not been defined

getClassSpecificValueback to summary
pack-priv Object getClassSpecificValue(String key)

Returns the value for a class specific property. A class specific value is a value that will be picked up based on class hierarchy.

Parameters
key:String

Key identifying class specific value

Returns:Object

Value, or null if one has not been defined.

getColorback to summary
public Color getColor(SynthContext context, ColorType type)

Overrides javax.swing.plaf.synth.SynthStyle.getColor.

Doc from javax.swing.plaf.synth.SynthStyle.getColor.

Returns the color for the specified state. This gives precedence to foreground and background of the JComponent. If the Color from the JComponent is not appropriate, or not used, this will invoke getColorForState. Subclasses should generally not have to override this, instead override getColorForState.

Annotations
@Override
getColorForStateback to summary
protected Color getColorForState(SynthContext context, ColorType type)

Implements abstract javax.swing.plaf.synth.SynthStyle.getColorForState.

Doc from javax.swing.plaf.synth.SynthStyle.getColorForState.

Returns the color for the specified state. This should NOT call any methods on the JComponent.

Annotations
@Override
getDefaultFontback to summary
pack-priv Font getDefaultFont()
getFontForStateback to summary
protected Font getFontForState(SynthContext context)

Implements abstract javax.swing.plaf.synth.SynthStyle.getFontForState.

Doc from javax.swing.plaf.synth.SynthStyle.getFontForState.

Returns the font for the specified state. This should NOT call any method on the JComponent.

Annotations
@Override
getGraphicsUtilsback to summary
public SynthGraphicsUtils getGraphicsUtils(SynthContext context)

Overrides javax.swing.plaf.synth.SynthStyle.getGraphicsUtils.

Doc from javax.swing.plaf.synth.SynthStyle.getGraphicsUtils.

Returns the SynthGraphicUtils for the specified context.

Annotations
@Override
getGTKColorback to summary
pack-priv Color getGTKColor(int state, ColorType type)
getGTKColorback to summary
pack-priv Color getGTKColor(int widgetType, int state, int colorType)
getGTKColorback to summary
pack-priv Color getGTKColor(SynthContext context, int state, ColorType type)

Returns the color for the specified state.

Parameters
context:SynthContext

SynthContext identifying requestor

state:int

to get the color for

type:ColorType

of the color

Returns:Color

Color to render with

getInsetsback to summary
public Insets getInsets(SynthContext state, Insets insets)

Overrides javax.swing.plaf.synth.SynthStyle.getInsets.

Returns the Insets. If insets is non-null the resulting insets will be placed in it, otherwise a new Insets object will be created and returned.

Parameters
state:SynthContext

SynthContext identifying requestor

insets:Insets

Where to place Insets

Returns:Insets

Insets.

Annotations
@Override
getMenuBarInsetsback to summary
private Insets getMenuBarInsets(SynthContext context, Insets insets)
getMenuItemInsetsback to summary
private Insets getMenuItemInsets(SynthContext context, Insets insets)
getPainterback to summary
public SynthPainter getPainter(SynthContext state)

Overrides javax.swing.plaf.synth.SynthStyle.getPainter.

Returns a SynthPainter that will route the appropriate calls to a GTKEngine.

Parameters
state:SynthContext

SynthContext identifying requestor

Returns:SynthPainter

SynthPainter

Annotations
@Override
getRadioInsetsback to summary
private Insets getRadioInsets(SynthContext context, Insets insets)
getScrollBarInsetsback to summary
private Insets getScrollBarInsets(SynthContext context, Insets insets)
getSeparatorInsetsback to summary
private Insets getSeparatorInsets(SynthContext context, Insets insets)
getSimpleInsetsback to summary
private Insets getSimpleInsets(SynthContext context, Insets insets, int n)
getSliderTrackInsetsback to summary
private Insets getSliderTrackInsets(SynthContext context, Insets insets)
getStockIconback to summary
private Icon getStockIcon(SynthContext context, String key, int type)
getStyleSpecificColorback to summary
private Color getStyleSpecificColor(SynthContext context, int state, ColorType type)

Returns color specific to the current style. This method is invoked when other variants don't fit.

getStyleSpecificIconback to summary
private Icon getStyleSpecificIcon(String key, GTKConstants.TextDirection direction, int type)
getTabbedPaneTabInsetsback to summary
private Insets getTabbedPaneTabInsets(SynthContext context, Insets insets)
getTextFieldInsetsback to summary
private Insets getTextFieldInsets(SynthContext context, Insets insets)
getThicknessInsetsback to summary
private Insets getThicknessInsets(SynthContext context, Insets insets)
getXThicknessback to summary
pack-priv int getXThickness()

Returns the X thickness to use for this GTKStyle.

Returns:int

x thickness.

getYThicknessback to summary
pack-priv int getYThickness()

Returns the Y thickness to use for this GTKStyle.

Returns:int

y thickness.

installDefaultsback to summary
public void installDefaults(SynthContext context)

Overrides javax.swing.plaf.synth.SynthStyle.installDefaults.

Doc from javax.swing.plaf.synth.SynthStyle.installDefaults.

Installs the necessary state from this Style on the JComponent from context.

Annotations
@Override
isOpaqueback to summary
public boolean isOpaque(SynthContext context)

Overrides javax.swing.plaf.synth.SynthStyle.isOpaque.

Returns the value to initialize the opacity property of the Component to. A Style should NOT assume the opacity will remain this value, the developer may reset it or override it.

Parameters
context:SynthContext

SynthContext identifying requestor

Returns:boolean

opaque Whether or not the JComponent is opaque.

Annotations
@Override
nativeGetClassValueback to summary
private static native Object nativeGetClassValue(int widgetType, String key)
nativeGetColorForStateback to summary
private static native int nativeGetColorForState(int widgetType, int state, int typeID)
nativeGetPangoFontNameback to summary
private static native String nativeGetPangoFontName(int widgetType)
nativeGetXThicknessback to summary
private static native int nativeGetXThickness(int widgetType)
nativeGetYThicknessback to summary
private static native int nativeGetYThickness(int widgetType)
com.sun.java.swing.plaf.gtk back to summary

pack-priv Class GTKStyle.GTKLazyValue

extends Object
implements LazyValue
Class Inheritance
All Implemented Interfaces
javax.swing.UIDefaults.LazyValue

GTKLazyValue is a slimmed down version of ProxyLazyValue. The code is duplicate so that it can get at the package private classes in gtk.

Field Summary

Modifier and TypeField and Description
private String
className

Name of the class to create.

private String

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
GTKLazyValue(String name, String methodName)

Method Summary

Modifier and TypeMethod and Description
public Object
createValue(UIDefaults table)

Implements javax.swing.UIDefaults.LazyValue.createValue.

Creates the actual value retrieved from the UIDefaults table.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNameback to summary
private String className

Name of the class to create.

methodNameback to summary
private String methodName

Constructor Detail

GTKLazyValueback to summary
pack-priv GTKLazyValue(String name)
GTKLazyValueback to summary
pack-priv GTKLazyValue(String name, String methodName)

Method Detail

createValueback to summary
public Object createValue(UIDefaults table)

Implements javax.swing.UIDefaults.LazyValue.createValue.

Doc from javax.swing.UIDefaults.LazyValue.createValue.

Creates the actual value retrieved from the UIDefaults table. When an object that implements this interface is retrieved from the table, this method is used to create the real value, which is then stored in the table and returned to the calling method.

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

private Class GTKStyle.GTKStockIcon

extends Object
implements SynthIcon
Class Inheritance
All Implemented Interfaces
javax.swing.plaf.synth.SynthIcon, javax.swing.Icon

An Icon that is fetched using getStockIcon.

Field Summary

Modifier and TypeField and Description
private String
private boolean
private boolean
private Icon
private Icon
private int
private SynthStyle

Constructor Summary

AccessConstructor and Description
pack-priv
GTKStockIcon(String key, int size)

Method Summary

Modifier and TypeMethod and Description
private Icon
public int
getIconHeight(SynthContext context)

Implements javax.swing.plaf.synth.SynthIcon.getIconHeight.

Returns the icon's height for the given synth context.

public int
getIconWidth(SynthContext context)

Implements javax.swing.plaf.synth.SynthIcon.getIconWidth.

Returns the icon's width for the given synth context.

public void
paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthIcon.paintIcon.

Paints the icon at the specified location for the given synth context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private String key
loadedLTRback to summary
private boolean loadedLTR
loadedRTLback to summary
private boolean loadedRTL
ltrIconback to summary
private Icon ltrIcon
rtlIconback to summary
private Icon rtlIcon
sizeback to summary
private int size
styleback to summary
private SynthStyle style

Constructor Detail

GTKStockIconback to summary
pack-priv GTKStockIcon(String key, int size)

Method Detail

getIconback to summary
private Icon getIcon(SynthContext context)
getIconHeightback to summary
public int getIconHeight(SynthContext context)

Implements javax.swing.plaf.synth.SynthIcon.getIconHeight.

Doc from javax.swing.plaf.synth.SynthIcon.getIconHeight.

Returns the icon's height for the given synth context.

Annotations
@Override
getIconWidthback to summary
public int getIconWidth(SynthContext context)

Implements javax.swing.plaf.synth.SynthIcon.getIconWidth.

Doc from javax.swing.plaf.synth.SynthIcon.getIconWidth.

Returns the icon's width for the given synth context.

Annotations
@Override
paintIconback to summary
public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthIcon.paintIcon.

Doc from javax.swing.plaf.synth.SynthIcon.paintIcon.

Paints the icon at the specified location for the given synth context.

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

pack-priv Class GTKStyle.GTKStockIconInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static Map<String, Integer>
private static Dimension[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static Dimension

Returns:

a Dimension object, or null if lsize is invalid
getIconSize
(int
icon type (GtkIconSize value)
type
)

Return the size of a particular icon type (logical size)

private static Dimension[]
public static int

Returns:

icon type. Valid types are 1 to 6
getIconType
(String
symbolic name, e.g. gtk-button
size
)

Return icon type (GtkIconSize value) given a symbolic name which can occur in a theme file.

private static void
public static void
setIconSize(int
icon type (GtkIconSize value)
type
,
int
the new icon width
w
,
int
the new icon height
h
)

Change icon size in a type to size mapping.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ICON_TYPE_MAPback to summary
private static Map<String, Integer> ICON_TYPE_MAP
iconSizesMapback to summary
private static Dimension[] iconSizesMap

Constructor Detail

GTKStockIconInfoback to summary
pack-priv GTKStockIconInfo()

Method Detail

getIconSizeback to summary
public static Dimension getIconSize(int type)

Return the size of a particular icon type (logical size)

Parameters
type:int

icon type (GtkIconSize value)

Returns:Dimension

a Dimension object, or null if lsize is invalid

getIconSizesMapback to summary
private static Dimension[] getIconSizesMap()
getIconTypeback to summary
public static int getIconType(String size)

Return icon type (GtkIconSize value) given a symbolic name which can occur in a theme file.

Parameters
size:String

symbolic name, e.g. gtk-button

Returns:int

icon type. Valid types are 1 to 6

initIconTypeMapback to summary
private static void initIconTypeMap()
setIconSizeback to summary
public static void setIconSize(int type, int w, int h)

Change icon size in a type to size mapping. This is called by code that parses the gtk-icon-sizes setting

Parameters
type:int

icon type (GtkIconSize value)

w:int

the new icon width

h:int

the new icon height