Package com.jidesoft.swing
Interface ComponentStateSupport
-
- All Known Implementing Classes:
CornerScroller
,HeaderBox
,JideButton
,JideSplitButton
,JideToggleButton
,JideToggleSplitButton
,NullJideButton
,SimpleScrollPane.ScrollButton
public interface ComponentStateSupport
A component should implement this interface if it supports various background and foreground for different states. Those states are defined inThemePainter
. 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.awt.Color
getBackgroundOfState(int state)
Gets the background for different states.java.awt.Color
getForegroundOfState(int state)
Gets the foreground for different states.void
setBackgroundOfState(int state, java.awt.Color color)
Sets the background for different states.void
setForegroundOfState(int state, java.awt.Color color)
Sets the foreground for different states.
-
-
-
Method Detail
-
getBackgroundOfState
java.awt.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, java.awt.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
java.awt.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, java.awt.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.
-
-