Class SubstanceButtonUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ButtonUI
-
- javax.swing.plaf.basic.BasicButtonUI
-
- org.pushingpixels.substance.internal.ui.SubstanceButtonUI
-
- All Implemented Interfaces:
ModificationAwareUI,TransitionAwareUI
public class SubstanceButtonUI extends BasicButtonUI implements TransitionAwareUI, ModificationAwareUI
UI for buttons in Substance look and feel.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBORDER_COMPUTEDProperty used during the button shaper switch.static StringBORDER_COMPUTINGProperty used during the button shaper switch.static StringBORDER_ORIGINALProperty used to store the original (pre-Substance) button border.protected AbstractButtonbuttonprotected GlowingIconglowingIconThe matching glowing icon.static StringICON_ORIGINALProperty used to store the original button icon.static StringIS_TITLE_CLOSE_BUTTONInternal property used to mark close buttons on title panes.static StringLOCK_OPACITYProperty used to lock the original (pre-Substance) button opacity.static StringOPACITY_ORIGINALProperty used to store the original (pre-Substance) button opacity.protected PropertyChangeListenersubstancePropertyListenerProperty change listener.protected ButtonVisualStateTrackersubstanceVisualStateTrackerTracker for visual state transitions.-
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
-
-
Constructor Summary
Constructors Constructor Description SubstanceButtonUI(AbstractButton button)Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(JComponent c, int x, int y)protected BasicButtonListenercreateButtonListener(AbstractButton b)static ComponentUIcreateUI(JComponent comp)org.pushingpixels.trident.TimelinegetModificationTimeline()DimensiongetPreferredSize(JComponent c)StateTransitionTrackergetTransitionTracker()Returns the model for tracking the transitions.protected voidinstallDefaults(AbstractButton b)protected voidinstallListeners(AbstractButton b)booleanisInside(MouseEvent me)Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.voidpaint(Graphics g, JComponent c)protected voidpaintButtonText(Graphics g, AbstractButton button, Rectangle textRect, String text)Paints the text.protected voidpaintIcon(Graphics g, JComponent c, Rectangle iconRect)protected voidtrackGlowingIcon()Tracks possible usage of glowing icon.protected voiduninstallDefaults(AbstractButton b)protected voiduninstallListeners(AbstractButton b)voidupdate(Graphics g, JComponent c)-
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, installUI, paintButtonPressed, paintFocus, paintText, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
getAccessibleChild, getAccessibleChildrenCount
-
-
-
-
Field Detail
-
BORDER_COMPUTED
public static final String BORDER_COMPUTED
Property used during the button shaper switch.- See Also:
- Constant Field Values
-
BORDER_COMPUTING
public static final String BORDER_COMPUTING
Property used during the button shaper switch.- See Also:
- Constant Field Values
-
BORDER_ORIGINAL
public static final String BORDER_ORIGINAL
Property used to store the original (pre-Substance) button border.- See Also:
- Constant Field Values
-
ICON_ORIGINAL
public static final String ICON_ORIGINAL
Property used to store the original button icon.- See Also:
- Constant Field Values
-
OPACITY_ORIGINAL
public static final String OPACITY_ORIGINAL
Property used to store the original (pre-Substance) button opacity.- See Also:
- Constant Field Values
-
LOCK_OPACITY
public static final String LOCK_OPACITY
Property used to lock the original (pre-Substance) button opacity.- See Also:
- Constant Field Values
-
IS_TITLE_CLOSE_BUTTON
public static final String IS_TITLE_CLOSE_BUTTON
Internal property used to mark close buttons on title panes.- See Also:
- Constant Field Values
-
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_PROPERTYproperty andAbstractButton.MODEL_CHANGED_PROPERTYproperty.
-
substanceVisualStateTracker
protected ButtonVisualStateTracker substanceVisualStateTracker
Tracker for visual state transitions.
-
button
protected AbstractButton button
-
-
Constructor Detail
-
SubstanceButtonUI
public SubstanceButtonUI(AbstractButton button)
Simple constructor.
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent comp)
-
installDefaults
protected void installDefaults(AbstractButton b)
- Overrides:
installDefaultsin classBasicButtonUI
-
uninstallDefaults
protected void uninstallDefaults(AbstractButton b)
- Overrides:
uninstallDefaultsin classBasicButtonUI
-
createButtonListener
protected BasicButtonListener createButtonListener(AbstractButton b)
- Overrides:
createButtonListenerin classBasicButtonUI
-
installListeners
protected void installListeners(AbstractButton b)
- Overrides:
installListenersin classBasicButtonUI
-
uninstallListeners
protected void uninstallListeners(AbstractButton b)
- Overrides:
uninstallListenersin classBasicButtonUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paintin classBasicButtonUI
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSizein classBasicButtonUI
-
contains
public boolean contains(JComponent c, int x, int y)
- Overrides:
containsin classComponentUI
-
paintIcon
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
- Overrides:
paintIconin classBasicButtonUI
-
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:
updatein classComponentUI
-
isInside
public boolean isInside(MouseEvent me)
Description copied from interface:TransitionAwareUIChecks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.- Specified by:
isInsidein interfaceTransitionAwareUI- Parameters:
me- Mouse event.- Returns:
trueif the mouse position of the specified event lies inside the area of the component designated for transition effects,falseotherwise.
-
getTransitionTracker
public StateTransitionTracker getTransitionTracker()
Description copied from interface:TransitionAwareUIReturns the model for tracking the transitions.- Specified by:
getTransitionTrackerin interfaceTransitionAwareUI- Returns:
- Model for tracking the transitions.
-
getModificationTimeline
public org.pushingpixels.trident.Timeline getModificationTimeline()
- Specified by:
getModificationTimelinein interfaceModificationAwareUI
-
-