org.jvnet.substance
Class SubstanceScrollBarUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ScrollBarUI
          extended by javax.swing.plaf.basic.BasicScrollBarUI
              extended by org.jvnet.substance.SubstanceScrollBarUI
All Implemented Interfaces:
java.awt.LayoutManager, javax.swing.SwingConstants, Trackable

public class SubstanceScrollBarUI
extends javax.swing.plaf.basic.BasicScrollBarUI
implements Trackable

UI for scroll bars in Substance look and feel.

Author:
Kirill Grouchnikov

Nested Class Summary
protected  class SubstanceScrollBarUI.PolicyChanger
          Listener on policy change menu items in debug UI mode.
protected  class SubstanceScrollBarUI.SubstanceArrowButtonListener
          Listener on arrow buttons.
protected  class SubstanceScrollBarUI.SubstanceTrackListener
          Track mouse drags.
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicScrollBarUI
javax.swing.plaf.basic.BasicScrollBarUI.ArrowButtonListener, javax.swing.plaf.basic.BasicScrollBarUI.ModelListener, javax.swing.plaf.basic.BasicScrollBarUI.PropertyChangeHandler, javax.swing.plaf.basic.BasicScrollBarUI.ScrollListener, javax.swing.plaf.basic.BasicScrollBarUI.TrackListener
 
Field Summary
protected  CompositeButtonModel compositeButtonsModel
          Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.
protected  CompositeButtonModel compositeScrollTrackModel
          Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.
protected  javax.swing.JButton mySecondDecreaseButton
          The second decrease button.
protected  javax.swing.JButton mySecondIncreaseButton
          The second increase button.
protected  int scrollBarWidth
          Scroll bar width.
protected  java.awt.event.AdjustmentListener substanceAdjustmentListener
          Listener on adjustments made to the scrollbar model - this is for the overlay mode (see SubstanceLookAndFeel.OVERLAY_PROPERTY and repaiting both scrollbars with the viewport.
protected  java.awt.event.MouseListener substanceDebugUiListener
          Listener for debui UI mode.
protected  org.jvnet.lafwidget.animation.FadeStateListener substanceFadeStateListener
          Listener for fade animations.
 
Fields inherited from class javax.swing.plaf.basic.BasicScrollBarUI
buttonListener, decrButton, DECREASE_HIGHLIGHT, incrButton, INCREASE_HIGHLIGHT, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollListener, scrollTimer, thumbColor, thumbDarkShadowColor, thumbHighlightColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
protected SubstanceScrollBarUI(javax.swing.JComponent b)
          Simple constructor.
 
Method Summary
protected  javax.swing.plaf.basic.BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
           
protected  javax.swing.JButton createDecreaseButton(int orientation)
           
protected  javax.swing.JButton createGeneralDecreaseButton(int orientation, boolean isRegular)
          Creates a decrease button.
protected  javax.swing.JButton createGeneralIncreaseButton(int orientation, boolean isRegular)
          Creates a increase button.
protected  javax.swing.JButton createIncreaseButton(int orientation)
           
protected  javax.swing.plaf.basic.BasicScrollBarUI.TrackListener createTrackListener()
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent b)
           
static java.lang.String getMemoryUsage()
          Returns the memory usage string.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
           
protected  ComponentState getState(javax.swing.JButton scrollButton)
          Returns the scroll button state.
protected  void installComponents()
           
protected  void installDefaults()
           
protected  void installListeners()
           
 boolean isInside(java.awt.event.MouseEvent me)
          Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.
protected  void layoutHScrollbar(javax.swing.JScrollBar sb)
           
protected  void layoutHScrollbarAdjacent(javax.swing.JScrollBar sb)
          Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.
protected  void layoutHScrollbarMultiple(javax.swing.JScrollBar sb)
          Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.
protected  void layoutHScrollbarMultipleBoth(javax.swing.JScrollBar sb)
          Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.
protected  void layoutHScrollbarNone(javax.swing.JScrollBar sb)
          Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#NONE.
protected  void layoutVScrollbar(javax.swing.JScrollBar sb)
           
protected  void layoutVScrollbarAdjacent(javax.swing.JScrollBar sb)
          Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.
protected  void layoutVScrollbarMultiple(javax.swing.JScrollBar sb)
          Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.
protected  void layoutVScrollbarMultipleBoth(javax.swing.JScrollBar sb)
          Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH.
protected  void layoutVScrollbarNone(javax.swing.JScrollBar sb)
          Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintThumb(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle thumbBounds)
           
protected  void paintTrack(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle trackBounds)
           
static void reset()
          Resets image maps (used when setting new theme).
 void scrollByBlock(int direction)
           
 void scrollByUnits(int direction, int units)
          Scrolls the associated scroll bar.
protected  void uninstallComponents()
           
protected  void uninstallListeners()
           
 
Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI
addLayoutComponent, configureScrollBarColors, createModelListener, createPropertyChangeListener, createScrollListener, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installKeyboardActions, installUI, isThumbRollover, layoutContainer, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, preferredLayoutSize, removeLayoutComponent, scrollByUnit, setThumbBounds, setThumbRollover, uninstallDefaults, uninstallKeyboardActions, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySecondDecreaseButton

protected javax.swing.JButton mySecondDecreaseButton
The second decrease button. Is shown under SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT, SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE and SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH modes.

Since:
version 3.1

mySecondIncreaseButton

protected javax.swing.JButton mySecondIncreaseButton
The second increase button. Is shown only under SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH mode.

Since:
version 3.1

substanceFadeStateListener

protected org.jvnet.lafwidget.animation.FadeStateListener substanceFadeStateListener
Listener for fade animations.


scrollBarWidth

protected int scrollBarWidth
Scroll bar width.


substanceDebugUiListener

protected java.awt.event.MouseListener substanceDebugUiListener
Listener for debui UI mode.


substanceAdjustmentListener

protected java.awt.event.AdjustmentListener substanceAdjustmentListener
Listener on adjustments made to the scrollbar model - this is for the overlay mode (see SubstanceLookAndFeel.OVERLAY_PROPERTY and repaiting both scrollbars with the viewport.

Since:
version 3.2

compositeScrollTrackModel

protected CompositeButtonModel compositeScrollTrackModel
Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.

Since:
version 3.2

compositeButtonsModel

protected CompositeButtonModel compositeButtonsModel
Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.

Since:
version 3.2
Constructor Detail

SubstanceScrollBarUI

protected SubstanceScrollBarUI(javax.swing.JComponent b)
Simple constructor.

Parameters:
b - Associated component.
Method Detail

reset

public static void reset()
Resets image maps (used when setting new theme).

See Also:
SubstanceLookAndFeel.setCurrentTheme(String), SubstanceLookAndFeel.setCurrentTheme(SubstanceTheme)

createUI

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

createGeneralDecreaseButton

protected javax.swing.JButton createGeneralDecreaseButton(int orientation,
                                                          boolean isRegular)
Creates a decrease button.

Parameters:
orientation - Button orientation.
isRegular - if true, the regular (upper / left) decrease button is created, if false, the additional (lower / right) decrease button is created for SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT, SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE and SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH kinds.
Returns:
Decrease button.

createDecreaseButton

protected javax.swing.JButton createDecreaseButton(int orientation)
Overrides:
createDecreaseButton in class javax.swing.plaf.basic.BasicScrollBarUI

createIncreaseButton

protected javax.swing.JButton createIncreaseButton(int orientation)
Overrides:
createIncreaseButton in class javax.swing.plaf.basic.BasicScrollBarUI

createGeneralIncreaseButton

protected javax.swing.JButton createGeneralIncreaseButton(int orientation,
                                                          boolean isRegular)
Creates a increase button.

Parameters:
orientation - Button orientation.
isRegular - if true, the regular (lower / right) increase button is created, if false, the additional (upper / left) increase button is created for SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH kind.
Returns:
Increase button.

getState

protected ComponentState getState(javax.swing.JButton scrollButton)
Returns the scroll button state.

Parameters:
scrollButton - Scroll button.
Returns:
Scroll button state.

paintTrack

protected void paintTrack(java.awt.Graphics g,
                          javax.swing.JComponent c,
                          java.awt.Rectangle trackBounds)
Overrides:
paintTrack in class javax.swing.plaf.basic.BasicScrollBarUI

paintThumb

protected void paintThumb(java.awt.Graphics g,
                          javax.swing.JComponent c,
                          java.awt.Rectangle thumbBounds)
Overrides:
paintThumb in class javax.swing.plaf.basic.BasicScrollBarUI

paint

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

installDefaults

protected void installDefaults()
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicScrollBarUI

installComponents

protected void installComponents()
Overrides:
installComponents in class javax.swing.plaf.basic.BasicScrollBarUI

uninstallComponents

protected void uninstallComponents()
Overrides:
uninstallComponents in class javax.swing.plaf.basic.BasicScrollBarUI

installListeners

protected void installListeners()
Overrides:
installListeners in class javax.swing.plaf.basic.BasicScrollBarUI

uninstallListeners

protected void uninstallListeners()
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicScrollBarUI

isInside

public boolean isInside(java.awt.event.MouseEvent me)
Description copied from interface: Trackable
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 Trackable
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.

scrollByBlock

public void scrollByBlock(int direction)
Overrides:
scrollByBlock in class javax.swing.plaf.basic.BasicScrollBarUI

scrollByUnits

public void scrollByUnits(int direction,
                          int units)
Scrolls the associated scroll bar.

Parameters:
direction - Direction.
units - Scroll units.

layoutVScrollbar

protected void layoutVScrollbar(javax.swing.JScrollBar sb)
Overrides:
layoutVScrollbar in class javax.swing.plaf.basic.BasicScrollBarUI

layoutHScrollbar

protected void layoutHScrollbar(javax.swing.JScrollBar sb)
Overrides:
layoutHScrollbar in class javax.swing.plaf.basic.BasicScrollBarUI

layoutVScrollbarAdjacent

protected void layoutVScrollbarAdjacent(javax.swing.JScrollBar sb)
Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.

Parameters:
sb - Scroll bar.

layoutVScrollbarNone

protected void layoutVScrollbarNone(javax.swing.JScrollBar sb)
Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.

Parameters:
sb - Scroll bar.

layoutVScrollbarMultiple

protected void layoutVScrollbarMultiple(javax.swing.JScrollBar sb)
Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.

Parameters:
sb - Scroll bar.

layoutVScrollbarMultipleBoth

protected void layoutVScrollbarMultipleBoth(javax.swing.JScrollBar sb)
Lays out the vertical scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE_BOTH.

Parameters:
sb - Scroll bar.

layoutHScrollbarAdjacent

protected void layoutHScrollbarAdjacent(javax.swing.JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#ADJACENT.

Parameters:
sb - Scroll bar.

layoutHScrollbarNone

protected void layoutHScrollbarNone(javax.swing.JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#NONE.

Parameters:
sb - Scroll bar.

layoutHScrollbarMultiple

protected void layoutHScrollbarMultiple(javax.swing.JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.

Parameters:
sb - Scroll bar.

layoutHScrollbarMultipleBoth

protected void layoutHScrollbarMultipleBoth(javax.swing.JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is SubstanceConstants.ScrollPaneButtonPolicyKind#MULTIPLE.

Parameters:
sb - Scroll bar.

getMemoryUsage

public static java.lang.String getMemoryUsage()
Returns the memory usage string.

Returns:
The memory usage string.

createTrackListener

protected javax.swing.plaf.basic.BasicScrollBarUI.TrackListener createTrackListener()
Overrides:
createTrackListener in class javax.swing.plaf.basic.BasicScrollBarUI

createArrowButtonListener

protected javax.swing.plaf.basic.BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
Overrides:
createArrowButtonListener in class javax.swing.plaf.basic.BasicScrollBarUI

getPreferredSize

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