org.jvnet.substance.api
public enum ComponentState extends java.lang.Enum<ComponentState>
This enum is used in order to provide uniform transition effects on mouse events. The effects include different visual appearance of the corresponding control when the mouse hovers over it (rollover), when it's pressed or selected, disabled etc.
Each enum value represents a single state and contains information that is used by the UI delegates in order to correctly paint the corresponding controls.
Modifier and Type | Class and Description |
---|---|
static class |
ComponentState.ColorSchemeKind
Enum for color scheme kind.
|
Enum Constant and Description |
---|
ACTIVE
Active.
|
ARMED
Armed.
|
DEFAULT
Default state.
|
DISABLED_ACTIVE
Disabled active.
|
DISABLED_SELECTED
Disabled selected.
|
DISABLED_UNSELECTED
Disabled and not selected.
|
PRESSED_SELECTED
Pressed selected.
|
PRESSED_UNSELECTED
Pressed and not selected.
|
ROLLOVER_ARMED
Armed and rolled over.
|
ROLLOVER_SELECTED
Selected and rolled over.
|
ROLLOVER_UNSELECTED
Not selected and rolled over.
|
SELECTED
Selected.
|
Modifier and Type | Method and Description |
---|---|
static ComponentState[] |
getActiveStates()
Returns all active component states.
|
ComponentState.ColorSchemeKind |
getColorSchemeKind()
Returns the corresponding color scheme kind
|
float |
getCyclePosition()
Returns the corresponding cycle count.
|
static ComponentState |
getState(javax.swing.AbstractButton button)
Returns the state of the specified button.
|
static ComponentState |
getState(boolean isEnabled,
boolean isRollover,
boolean isSelected)
Returns the component state that matches the specified parameters.
|
static ComponentState |
getState(javax.swing.ButtonModel model,
javax.swing.JComponent component)
Retrieves component state based on the button model (required parameter)
and component itself (optional parameter).
|
static ComponentState |
getState(javax.swing.ButtonModel model,
javax.swing.JComponent component,
boolean toIgnoreSelection)
Retrieves component state based on the button model (required parameter)
and button itself (optional parameter).
|
boolean |
isKindActive(org.jvnet.lafwidget.animation.FadeKind fadeKind)
Returns indication whether
this component state is "active"
under the specified fade kind. |
static ComponentState |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ComponentState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ComponentState DISABLED_ACTIVE
default
.public static final ComponentState ACTIVE
default
.public static final ComponentState DISABLED_SELECTED
public static final ComponentState DISABLED_UNSELECTED
public static final ComponentState PRESSED_SELECTED
public static final ComponentState PRESSED_UNSELECTED
public static final ComponentState SELECTED
public static final ComponentState ROLLOVER_SELECTED
public static final ComponentState ARMED
public static final ComponentState ROLLOVER_ARMED
public static final ComponentState ROLLOVER_UNSELECTED
public static final ComponentState DEFAULT
public static ComponentState[] values()
for (ComponentState c : ComponentState.values()) System.out.println(c);
public static ComponentState valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namejava.lang.NullPointerException
- if the argument is nullpublic ComponentState.ColorSchemeKind getColorSchemeKind()
public float getCyclePosition()
public boolean isKindActive(org.jvnet.lafwidget.animation.FadeKind fadeKind)
this
component state is "active"
under the specified fade kind. For example, ROLLOVER_SELECTED
will return true
for both FadeKind.ROLLOVER
and
FadeKind.SELECTION
.fadeKind
- Fade kind.true
if this
component state is
"active" under the specified fade kind (for example,
ROLLOVER_SELECTED
will return true
for both
FadeKind.ROLLOVER
and FadeKind.SELECTION
),
false
otherwise.public static ComponentState[] getActiveStates()
public static ComponentState getState(javax.swing.ButtonModel model, javax.swing.JComponent component)
model
- Button model (required).component
- Component (optional).public static ComponentState getState(javax.swing.AbstractButton button)
button
- Button.public static ComponentState getState(javax.swing.ButtonModel model, javax.swing.JComponent component, boolean toIgnoreSelection)
model
- Button model (required).component
- Component (optional).toIgnoreSelection
- If true
, the ButtonModel.isSelected()
will not be checked. This can be used for tracking transitions
on menu items that use armed
state instead, when
we don't want to use different rollover themes for selected
and unselected checkbox and radio button menu items (to
preserve consistent visual appearence of highlights).public static ComponentState getState(boolean isEnabled, boolean isRollover, boolean isSelected)
isEnabled
- Enabled flag.isRollover
- Rollover flag.isSelected
- Selected flag.