org.jvnet.substance
Class SubstanceButtonUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by org.jvnet.substance.SubstanceButtonUI

public class SubstanceButtonUI
extends javax.swing.plaf.basic.BasicButtonUI

UI for buttons in Substance look and feel.

Author:
Kirill Grouchnikov

Field Summary
static java.lang.String BORDER_COMPUTED
          Property used during the button shaper switch.
static java.lang.String BORDER_COMPUTING
          Property used during the button shaper switch.
static java.lang.String BORDER_ORIGINAL
          Property used to store the original (pre-Substance) button border.
protected  GlowingIcon glowingIcon
          The matching glowing icon.
static java.lang.String ICON_ORIGINAL
          Property used to store the original button icon.
static java.lang.String IS_TITLE_CLOSE_BUTTON
          Internal property used to mark close buttons on title panes.
static java.lang.String LOCK_OPACITY
          Property used to lock the original (pre-Substance) button opacity.
static java.lang.String OPACITY_ORIGINAL
          Property used to store the original (pre-Substance) button opacity.
protected  java.beans.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
SubstanceButtonUI()
          Simple constructor.
 
Method Summary
 boolean contains(javax.swing.JComponent c, int x, int y)
           
protected  javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
           
protected  void installDefaults(javax.swing.AbstractButton b)
           
protected  void installListeners(javax.swing.AbstractButton b)
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintButtonText(java.awt.Graphics g, javax.swing.AbstractButton button, java.awt.Rectangle textRect, java.lang.String text)
          Paints the text.
protected  void paintFocus(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)
           
protected  void paintIcon(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle iconRect)
           
protected  void trackGlowingIcon(javax.swing.AbstractButton b)
          Tracks possible usage of glowing icon.
protected  void uninstallDefaults(javax.swing.AbstractButton b)
           
protected  void uninstallListeners(javax.swing.AbstractButton b)
           
 void update(java.awt.Graphics g, javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, installUI, paintButtonPressed, 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 Detail

BORDER_COMPUTED

public static final java.lang.String BORDER_COMPUTED
Property used during the button shaper switch.

See Also:
Constant Field Values

BORDER_COMPUTING

public static final java.lang.String BORDER_COMPUTING
Property used during the button shaper switch.

See Also:
Constant Field Values

BORDER_ORIGINAL

public static final java.lang.String BORDER_ORIGINAL
Property used to store the original (pre-Substance) button border.

See Also:
Constant Field Values

ICON_ORIGINAL

public static final java.lang.String ICON_ORIGINAL
Property used to store the original button icon.

See Also:
Constant Field Values

OPACITY_ORIGINAL

public static final java.lang.String OPACITY_ORIGINAL
Property used to store the original (pre-Substance) button opacity.

See Also:
Constant Field Values

LOCK_OPACITY

public static final java.lang.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 java.lang.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 FadeConfigurationManager.fadeAllowed(FadeKind, Component) returns true on FadeKind.ICON_GLOW.


substancePropertyListener

protected java.beans.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.

Constructor Detail

SubstanceButtonUI

public SubstanceButtonUI()
Simple constructor.

Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)

installDefaults

protected void installDefaults(javax.swing.AbstractButton b)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicButtonUI

uninstallDefaults

protected void uninstallDefaults(javax.swing.AbstractButton b)
Overrides:
uninstallDefaults in class javax.swing.plaf.basic.BasicButtonUI

createButtonListener

protected javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
Overrides:
createButtonListener in class javax.swing.plaf.basic.BasicButtonUI

installListeners

protected void installListeners(javax.swing.AbstractButton b)
Overrides:
installListeners in class javax.swing.plaf.basic.BasicButtonUI

uninstallListeners

protected void uninstallListeners(javax.swing.AbstractButton b)
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicButtonUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides:
paint in class javax.swing.plaf.basic.BasicButtonUI

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicButtonUI

paintFocus

protected void paintFocus(java.awt.Graphics g,
                          javax.swing.AbstractButton b,
                          java.awt.Rectangle viewRect,
                          java.awt.Rectangle textRect,
                          java.awt.Rectangle iconRect)
Overrides:
paintFocus in class javax.swing.plaf.basic.BasicButtonUI

contains

public boolean contains(javax.swing.JComponent c,
                        int x,
                        int y)
Overrides:
contains in class javax.swing.plaf.ComponentUI

paintIcon

protected void paintIcon(java.awt.Graphics g,
                         javax.swing.JComponent c,
                         java.awt.Rectangle iconRect)
Overrides:
paintIcon in class javax.swing.plaf.basic.BasicButtonUI

paintButtonText

protected void paintButtonText(java.awt.Graphics g,
                               javax.swing.AbstractButton button,
                               java.awt.Rectangle textRect,
                               java.lang.String text)
Paints the text.

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

trackGlowingIcon

protected void trackGlowingIcon(javax.swing.AbstractButton b)
Tracks possible usage of glowing icon.

Parameters:
b - Button.

update

public void update(java.awt.Graphics g,
                   javax.swing.JComponent c)
Overrides:
update in class javax.swing.plaf.ComponentUI