public class SwingBackgroundAdapter extends AbstractStateAdapter
Constructor and Description |
---|
SwingBackgroundAdapter(Color pDisabledColor)
Create a new adapter with no state associated.
|
SwingBackgroundAdapter(State pState)
Create a new adapter with a state and a default background Color.
|
SwingBackgroundAdapter(State pState,
Color pDisabledColor)
Create a new adapter.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjustInitialState(Object pTarget,
boolean pEnabled)
We store the original Color of the background of the component, and call processStateChange()
afterwards.
|
protected void |
processStateChange(Object pTarget,
boolean pEnabled)
We map the pEnabled boolean to the setting/re-setting of a background Color
on a JComponent.
|
void |
setDisabledBackgound(Color pDisabledColor)
Sets the disabled Color for the background, the new Color will be shown at the next
state change.
|
add, add, addInvert, getConsistencyCategory, getName, remove, setName, setState, stateChanged
public SwingBackgroundAdapter(State pState)
pState
- the state we adaptpublic SwingBackgroundAdapter(Color pDisabledColor)
pDisabledColor
- the Color for the disabled state, must not be nullIllegalArgumentException
- if pDisabledColor is nullpublic SwingBackgroundAdapter(State pState, Color pDisabledColor)
pState
- the state we adaptpDisabledColor
- the Color for the disabled state, must not be nullIllegalArgumentException
- if pDisabledColor is nullpublic void setDisabledBackgound(Color pDisabledColor)
pDisabledColor
- the Color for the disabled state, must not be nullprotected void adjustInitialState(Object pTarget, boolean pEnabled)
adjustInitialState
in class AbstractStateAdapter
pTarget
- the target we should adjustpEnabled
- the state for the targetprotected void processStateChange(Object pTarget, boolean pEnabled)
processStateChange
in class AbstractStateAdapter
pTarget
- target object, must be a JComponentpEnabled
- true if the target object should get "enabled"IllegalStateException
- if pTarget is not a JComponentCopyright © 2017 Jürgen Zeller (privat). All rights reserved.