Class SubstanceToggleButtonUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ButtonUI
-
- javax.swing.plaf.basic.BasicButtonUI
-
- javax.swing.plaf.basic.BasicToggleButtonUI
-
- org.pushingpixels.substance.internal.ui.SubstanceToggleButtonUI
-
- All Implemented Interfaces:
TransitionAwareUI
public class SubstanceToggleButtonUI extends BasicToggleButtonUI implements TransitionAwareUI
UI for toggle buttons in Substance look and feel.
-
-
Field Summary
Fields Modifier and Type Field Description protected GlowingIcon
glowingIcon
The matching glowing icon.protected PropertyChangeListener
substancePropertyListener
Property change listener.protected ButtonVisualStateTracker
substanceVisualStateTracker
Tracker for visual state transitions.protected JToggleButton
toggleButton
-
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
-
-
Constructor Summary
Constructors Constructor Description SubstanceToggleButtonUI(JToggleButton toggleButton)
Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(JComponent c, int x, int y)
protected BasicButtonListener
createButtonListener(AbstractButton b)
static ComponentUI
createUI(JComponent comp)
Dimension
getPreferredSize(JComponent c)
StateTransitionTracker
getTransitionTracker()
Returns the model for tracking the transitions.void
installDefaults(AbstractButton b)
protected void
installListeners(AbstractButton b)
boolean
isInside(MouseEvent me)
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.void
paint(Graphics g, JComponent c)
protected void
paintButtonText(Graphics g, AbstractButton button, Rectangle textRect, String text)
Paints the text.protected void
paintIcon(Graphics g, AbstractButton b, Rectangle iconRect)
protected void
trackGlowingIcon()
Tracks possible usage of glowing icon.void
uninstallDefaults(AbstractButton b)
protected void
uninstallListeners(AbstractButton b)
void
update(Graphics g, JComponent c)
-
Methods inherited from class javax.swing.plaf.basic.BasicToggleButtonUI
getPropertyPrefix, getTextShiftOffset
-
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, installKeyboardActions, installUI, paintButtonPressed, paintFocus, paintIcon, paintText, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
getAccessibleChild, getAccessibleChildrenCount
-
-
-
-
Field Detail
-
glowingIcon
protected GlowingIcon glowingIcon
The matching glowing icon. Is used only whenAnimationConfigurationManager.isAnimationAllowed(AnimationFacet, Component)
returns true onAnimationFacet.ICON_GLOW
.
-
substancePropertyListener
protected PropertyChangeListener substancePropertyListener
Property change listener. Listens on changes to theSubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY
property andAbstractButton.MODEL_CHANGED_PROPERTY
property.
-
substanceVisualStateTracker
protected ButtonVisualStateTracker substanceVisualStateTracker
Tracker for visual state transitions.
-
toggleButton
protected JToggleButton toggleButton
-
-
Constructor Detail
-
SubstanceToggleButtonUI
public SubstanceToggleButtonUI(JToggleButton toggleButton)
Simple constructor.
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent comp)
-
installDefaults
public void installDefaults(AbstractButton b)
- Overrides:
installDefaults
in classBasicButtonUI
-
uninstallDefaults
public void uninstallDefaults(AbstractButton b)
- Overrides:
uninstallDefaults
in classBasicButtonUI
-
createButtonListener
protected BasicButtonListener createButtonListener(AbstractButton b)
- Overrides:
createButtonListener
in classBasicButtonUI
-
installListeners
protected void installListeners(AbstractButton b)
- Overrides:
installListeners
in classBasicButtonUI
-
uninstallListeners
protected void uninstallListeners(AbstractButton b)
- Overrides:
uninstallListeners
in classBasicButtonUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paint
in classBasicToggleButtonUI
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSize
in classBasicButtonUI
-
contains
public boolean contains(JComponent c, int x, int y)
- Overrides:
contains
in classComponentUI
-
paintIcon
protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect)
- Overrides:
paintIcon
in classBasicToggleButtonUI
-
paintButtonText
protected void paintButtonText(Graphics g, AbstractButton button, Rectangle textRect, String text)
Paints the text.- Parameters:
g
- Graphic contextbutton
- ButtontextRect
- Text rectangletext
- Text to paint
-
trackGlowingIcon
protected void trackGlowingIcon()
Tracks possible usage of glowing icon.
-
update
public void update(Graphics g, JComponent c)
- Overrides:
update
in classComponentUI
-
isInside
public boolean isInside(MouseEvent me)
Description copied from interface:TransitionAwareUI
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.- Specified by:
isInside
in interfaceTransitionAwareUI
- Parameters:
me
- Mouse event.- Returns:
true
if the mouse position of the specified event lies inside the area of the component designated for transition effects,false
otherwise.
-
getTransitionTracker
public StateTransitionTracker getTransitionTracker()
Description copied from interface:TransitionAwareUI
Returns the model for tracking the transitions.- Specified by:
getTransitionTracker
in interfaceTransitionAwareUI
- Returns:
- Model for tracking the transitions.
-
-