JIDE 3.5.15

com.jidesoft.swing
Interface ComponentStateSupport

All Known Implementing Classes:
AutoFilterBox, AutoFilterTableHeaderRenderer, BasicDockableFrameTitlePane.NoFocusButton, ColorChooserPanel.ColorButton, CornerScroller, FieldBox, FloorTabbedPane.FloorButton, GadgetPaletteButton, HeaderBox, JideButton, JideColorSplitButton, JideSplitButton, JideToggleButton, JideToggleSplitButton, NullJideButton, OutlookTabbedPane.OutlookButton, SimpleScrollPane.ScrollButton, XertoDockableFrameUI.XertoDockableFrameTitlePane.XertoNoFocusButton

public interface ComponentStateSupport

A component should implement this interface if it supports various background and foreground for different states. Those states are defined in ThemePainter.

For components that implements this interface, you can use the methods to change its background or foreground for different states such as rollover state, selected state or pressed state. JideButton and JideSplitButton are two classes that support this.

Please note, not all L&Fs support this. Vsnet and Office 2003 style support it but Xerto and Eclipse style don't.


Method Summary
 Color getBackgroundOfState(int state)
          Gets the background for different states.
 Color getForegroundOfState(int state)
          Gets the foreground for different states.
 void setBackgroundOfState(int state, Color color)
          Sets the background for different states.
 void setForegroundOfState(int state, Color color)
          Sets the foreground for different states.
 

Method Detail

getBackgroundOfState

Color getBackgroundOfState(int state)
Gets the background for different states. The states are defined in ThemePainter as constants. Not all states are supported by all components. If the state is not supported or background is never set, it will return null.

Please note, each L&F will have its own way to paint the different backgrounds. This method allows you to customize it for each component to use a different background. So if you want the background to be used, don't use a ColorUIResource because UIResource is considered as a setting set by the L&F and any L&F can choose to ignore it.

Parameters:
state - the button state. Valid values are ThemePainter.STATE_DEFAULT, ThemePainter.STATE_ROLLOVER, ThemePainter.STATE_SELECTED and ThemePainter.STATE_PRESSED.
Returns:
the background for different states.

setBackgroundOfState

void setBackgroundOfState(int state,
                          Color color)
Sets the background for different states.

Parameters:
state - the button state. Valid values are ThemePainter.STATE_DEFAULT, ThemePainter.STATE_ROLLOVER, ThemePainter.STATE_SELECTED and ThemePainter.STATE_PRESSED.
color - the new background for the state.

getForegroundOfState

Color getForegroundOfState(int state)
Gets the foreground for different states. The states are defined in ThemePainter as constants. Not all states are supported by all components. If the state is not supported or foreground is never set, it will return null.

Please note, each L&F will have its own way to paint the different foregrounds. This method allows you to customize it for each component to use a different foreground. So if you want the foreground to be used, don't use a ColorUIResource because UIResource is considered as a setting set by the L&F and any L&F can choose to ignore it.

Parameters:
state - the button state. Valid values are ThemePainter.STATE_DEFAULT, ThemePainter.STATE_ROLLOVER, ThemePainter.STATE_SELECTED and ThemePainter.STATE_PRESSED.
Returns:
the foreground for different states.

setForegroundOfState

void setForegroundOfState(int state,
                          Color color)
Sets the foreground for different states.

Parameters:
state - the button state. Valid values are ThemePainter.STATE_DEFAULT, ThemePainter.STATE_ROLLOVER, ThemePainter.STATE_SELECTED and ThemePainter.STATE_PRESSED.
color - the new foreground for the state.

JIDE 3.5.15