com.alee.laf.scroll
Class WebScrollBarUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ScrollBarUI
          extended by javax.swing.plaf.basic.BasicScrollBarUI
              extended by com.alee.laf.scroll.WebScrollBarUI
All Implemented Interfaces:
Styleable, BorderMethods, SwingMethods, java.awt.LayoutManager, javax.swing.SwingConstants

public class WebScrollBarUI
extends javax.swing.plaf.basic.BasicScrollBarUI
implements Styleable, BorderMethods

Custom UI for JScrollBar component.

Author:
Mikle Garin

Nested Class Summary
 
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  ScrollBarButtonPainter decreaseButtonPainter
           
protected  ScrollBarButtonPainter increaseButtonPainter
           
protected  java.awt.Insets margin
          UI style settings.
protected  java.beans.PropertyChangeListener orientationChangeListener
          Scroll bar listeners.
protected  boolean paintButtons
           
protected  ScrollBarPainter painter
          Component painters.
protected  boolean paintTrack
           
protected  int scrollBarWidth
           
protected  java.lang.String styleId
          Runtime variables.
 
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
WebScrollBarUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebScrollBarUI for the specified component.
 Painter getDecreaseButtonPainter()
          Returns decrease button painter.
 Painter getIncreaseButtonPainter()
          Returns increase button painter.
 java.awt.Insets getMargin()
          Returns scroll bar content margin.
 Painter getPainter()
          Returns scroll bar painter.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          
 int getScrollBarWidth()
          Returns scroll bar width.
 java.lang.String getStyleId()
          Returns component style ID.
protected  void installComponents()
          Installs additional scroll bar components.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isPaintButtons()
          Returns whether scroll bar arrow buttons should be displayed or not.
 boolean isPaintTrack()
          Returns whether scroll bar track should be displayed or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints scroll bar decorations.
 void setDecreaseButtonPainter(Painter painter)
          Sets decrease button painter.
 void setIncreaseButtonPainter(Painter painter)
          Sets increase button painter.
 void setMargin(java.awt.Insets margin)
          Sets scroll bar content margin.
 void setPaintButtons(boolean paintButtons)
          Sets whether scroll bar arrow buttons should be displayed or not.
 void setPainter(Painter painter)
          Sets scroll bar painter.
 void setPaintTrack(boolean paintTrack)
          Sets whether scroll bar track should be displayed or not.
 void setScrollBarWidth(int scrollBarWidth)
          Sets scroll bar width.
 void setStyleId(java.lang.String id)
          Sets custom component style ID.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 void updateBorder()
          Updates custom WebLaF border.
 
Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI
addLayoutComponent, configureScrollBarColors, createArrowButtonListener, createDecreaseButton, createIncreaseButton, createModelListener, createPropertyChangeListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installDefaults, installKeyboardActions, installListeners, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, paintThumb, paintTrack, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbBounds, setThumbRollover, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
 
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

margin

protected java.awt.Insets margin
UI style settings.


scrollBarWidth

protected int scrollBarWidth

paintButtons

protected boolean paintButtons

paintTrack

protected boolean paintTrack

painter

protected ScrollBarPainter painter
Component painters.


decreaseButtonPainter

protected ScrollBarButtonPainter decreaseButtonPainter

increaseButtonPainter

protected ScrollBarButtonPainter increaseButtonPainter

orientationChangeListener

protected java.beans.PropertyChangeListener orientationChangeListener
Scroll bar listeners.


styleId

protected java.lang.String styleId
Runtime variables.

Constructor Detail

WebScrollBarUI

public WebScrollBarUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebScrollBarUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebScrollBarUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicScrollBarUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicScrollBarUI
Parameters:
c - component with this UI

getStyleId

public java.lang.String getStyleId()
Returns component style ID. Custom ID can be specified to override default component style using "setStyleId" method. If style for such custom ID is not found in skin descriptor then default style for that component is used.

Specified by:
getStyleId in interface Styleable
Returns:
component style ID

setStyleId

public void setStyleId(java.lang.String id)
Sets custom component style ID. If style for such custom ID is not found in skin descriptor default style will be used for that component. This method forces component to instantly use component style with the specified ID.

Specified by:
setStyleId in interface Styleable
Parameters:
id - custom component style ID

updateBorder

public void updateBorder()
Updates custom WebLaF border.

Specified by:
updateBorder in interface BorderMethods

isPaintButtons

public boolean isPaintButtons()
Returns whether scroll bar arrow buttons should be displayed or not.

Returns:
true if scroll bar arrow buttons should be displayed, false otherwise

setPaintButtons

public void setPaintButtons(boolean paintButtons)
Sets whether scroll bar arrow buttons should be displayed or not.

Parameters:
paintButtons - whether scroll bar arrow buttons should be displayed or not

isPaintTrack

public boolean isPaintTrack()
Returns whether scroll bar track should be displayed or not.

Returns:
true if scroll bar track should be displayed, false otherwise

setPaintTrack

public void setPaintTrack(boolean paintTrack)
Sets whether scroll bar track should be displayed or not.

Parameters:
paintTrack - whether scroll bar track should be displayed or not

getMargin

public java.awt.Insets getMargin()
Returns scroll bar content margin.

Returns:
scroll bar content margin

setMargin

public void setMargin(java.awt.Insets margin)
Sets scroll bar content margin.

Parameters:
margin - new scroll bar content margin

getScrollBarWidth

public int getScrollBarWidth()
Returns scroll bar width.

Returns:
scroll bar width

setScrollBarWidth

public void setScrollBarWidth(int scrollBarWidth)
Sets scroll bar width.

Parameters:
scrollBarWidth - new scroll bar width

getPainter

public Painter getPainter()
Returns scroll bar painter.

Returns:
scroll bar painter

setPainter

public void setPainter(Painter painter)
Sets scroll bar painter. Pass null to remove scroll bar painter.

Parameters:
painter - new scroll bar painter

getDecreaseButtonPainter

public Painter getDecreaseButtonPainter()
Returns decrease button painter. This the button displayed at top or left side of the scroll bar.

Returns:
decrease button painter

setDecreaseButtonPainter

public void setDecreaseButtonPainter(Painter painter)
Sets decrease button painter. This the button displayed at top or left side of the scroll bar.

Parameters:
painter - new decrease button painter

getIncreaseButtonPainter

public Painter getIncreaseButtonPainter()
Returns increase button painter. This the button displayed at bottom or right side of the scroll bar.

Returns:
increase button painter

setIncreaseButtonPainter

public void setIncreaseButtonPainter(Painter painter)
Sets increase button painter. This the button displayed at bottom or right side of the scroll bar.

Parameters:
painter - new increase button painter

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints scroll bar decorations. The whole painting process is delegated to installed painter class.

Overrides:
paint in class javax.swing.plaf.basic.BasicScrollBarUI
Parameters:
g - graphics context
c - scroll bar component

installComponents

protected void installComponents()
Installs additional scroll bar components.

Overrides:
installComponents 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