Package org.pushingpixels.substance.internal.ui

# 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 final String`
`BORDER_COMPUTED`
Property used during the button shaper switch.
`static final String`
`BORDER_COMPUTING`
Property used during the button shaper switch.
`static final String`
`BORDER_ORIGINAL`
Property used to store the original (pre-Substance) button border.
`protected AbstractButton`
`button`
`protected GlowingIcon`
`glowingIcon`
The matching glowing icon.
`static final String`
`ICON_ORIGINAL`
Property used to store the original button icon.
`static final String`
`IS_TITLE_CLOSE_BUTTON`
Internal property used to mark close buttons on title panes.
`static final String`
`LOCK_OPACITY`
Property used to lock the original (pre-Substance) button opacity.
`static final String`
`OPACITY_ORIGINAL`
Property used to store the original (pre-Substance) button opacity.
`protected PropertyChangeListener`
`substancePropertyListener`
Property change listener.
`protected ButtonVisualStateTracker`
`substanceVisualStateTracker`
Tracker 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

Modifier and Type
Method
Description
`boolean`
`contains(JComponent c, int x, int y)`
`protected BasicButtonListener`
`createButtonListener(AbstractButton b)`
`static ComponentUI`
`createUI(JComponent comp)`
`org.pushingpixels.trident.Timeline`
`getModificationTimeline()`
`Dimension`
`getPreferredSize(JComponent c)`
`StateTransitionTracker`
`getTransitionTracker()`
Returns the model for tracking the transitions.
`protected 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, JComponent c, Rectangle iconRect)`
`protected void`
`trackGlowingIcon()`
Tracks possible usage of glowing icon.
`protected void`
`uninstallDefaults(AbstractButton b)`
`protected void`
`uninstallListeners(AbstractButton b)`
`void`
`update(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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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 when `AnimationConfigurationManager.isAnimationAllowed(AnimationFacet, Component)` returns true on `AnimationFacet.ICON_GLOW`.

### substancePropertyListener

protected PropertyChangeListener substancePropertyListener
Property change listener. Listens on changes to the `SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY` property and `AbstractButton.MODEL_CHANGED_PROPERTY` property.

### substanceVisualStateTracker

protected ButtonVisualStateTracker substanceVisualStateTracker
Tracker for visual state transitions.

### button

protected AbstractButton button

## Constructor Details

### SubstanceButtonUI

public SubstanceButtonUI(AbstractButton button)
Simple constructor.

## Method Details

### createUI

public static ComponentUI createUI(JComponent comp)

### installDefaults

protected void installDefaults(AbstractButton b)

Overrides:
  `installDefaults` in class `BasicButtonUI`

### uninstallDefaults

protected void uninstallDefaults(AbstractButton b)

Overrides:
  `uninstallDefaults` in class `BasicButtonUI`

### createButtonListener

protected BasicButtonListener createButtonListener(AbstractButton b)

Overrides:
  `createButtonListener` in class `BasicButtonUI`

### installListeners

protected void installListeners(AbstractButton b)

Overrides:
  `installListeners` in class `BasicButtonUI`

### uninstallListeners

protected void uninstallListeners(AbstractButton b)

Overrides:
  `uninstallListeners` in class `BasicButtonUI`

### paint

public void paint(Graphics g, JComponent c)

Overrides:
  `paint` in class `BasicButtonUI`

### getPreferredSize

public Dimension getPreferredSize(JComponent c)

Overrides:
  `getPreferredSize` in class `BasicButtonUI`

### contains

public boolean contains(JComponent c, int x, int y)

Overrides:
  `contains` in class `ComponentUI`

### paintIcon

protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)

Overrides:
  `paintIcon` in class `BasicButtonUI`

### paintButtonText

protected void paintButtonText(Graphics g, AbstractButton button, Rectangle textRect, String text)
Paints the text.

Parameters:
  `g` - Graphic context
  `button` - Button
  `textRect` - Text rectangle
  `text` - Text to paint

### trackGlowingIcon

protected void trackGlowingIcon()
Tracks possible usage of glowing icon.

### update

public void update(Graphics g, JComponent c)

Overrides:
  `update` in class `ComponentUI`

### 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 interface `TransitionAwareUI`
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 interface `TransitionAwareUI`
Returns:
  Model for tracking the transitions.

### getModificationTimeline

public org.pushingpixels.trident.Timeline getModificationTimeline()

Specified by:
  `getModificationTimeline` in interface `ModificationAwareUI`