com.alee.managers.style.skin.web
Class WebScrollBarButtonPainter<E extends javax.swing.AbstractButton>

java.lang.Object
  extended by com.alee.extended.painter.AbstractPainter<E>
      extended by com.alee.managers.style.skin.web.WebScrollBarButtonPainter<E>
All Implemented Interfaces:
Painter<E>, ScrollBarButtonPainter<E>

public class WebScrollBarButtonPainter<E extends javax.swing.AbstractButton>
extends AbstractPainter<E>
implements ScrollBarButtonPainter<E>

Base painter for JScrollBar arrow buttons.

Author:
Mikle Garin

Field Summary
protected static java.lang.String ARROW_BUTTON_SHAPE
          Shape cache key.
protected  java.awt.Color backgroundColor
           
protected  java.awt.Color borderColor
          Style settings.
protected  ScrollBarButtonType buttonType
          Runtime variables.
protected  java.awt.Color disabledBackgroundColor
           
protected  java.awt.Color disabledBorderColor
           
protected  java.awt.Color pressedBackgroundColor
           
protected  java.awt.Color pressedBorderColor
           
protected  java.awt.Color rolloverBackgroundColor
           
protected  java.awt.Color rolloverBorderColor
           
protected  javax.swing.JScrollBar scrollbar
           
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
WebScrollBarButtonPainter()
          Constructs new scroll bar button painter.
 
Method Summary
protected  java.awt.Shape createArrowButtonShape(java.awt.Rectangle bounds, E button)
          Returns arrow button shape.
protected  java.awt.Shape getArrowButtonShape(java.awt.Rectangle bounds, E button)
          Returns popup border shape.
 java.awt.Color getBackgroundColor()
          Returns button background color.
 java.awt.Color getBorderColor()
          Returns button border color.
protected  java.lang.Object[] getCachedShapeSettings(E button)
          Returns an array of shape settings cached along with the shape.
 java.awt.Color getDisabledBackgroundColor()
          Returns disabled button background color.
 java.awt.Color getDisabledBorderColor()
          Returns disabled button border color.
 java.awt.Insets getMargin(E button)
          Returns margin required for visual data provided by this painter.
 java.awt.Color getPressedBackgroundColor()
          Returns pressed button background color.
 java.awt.Color getPressedBorderColor()
          Returns pressed button border color.
 java.awt.Color getRolloverBackgroundColor()
          Returns rollover button background color.
 java.awt.Color getRolloverBorderColor()
          Returns rollover button border color.
 void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E button)
          Paints visual data onto the component graphics.
 void setBackgroundColor(java.awt.Color color)
          Sets button background color.
 void setBorderColor(java.awt.Color color)
          Sets button border color.
 void setButtonType(ScrollBarButtonType type)
          Sets scroll bar button type.
 void setDisabledBackgroundColor(java.awt.Color color)
          Sets disabled button background color.
 void setDisabledBorderColor(java.awt.Color color)
          Sets disabled button border color.
 void setPressedBackgroundColor(java.awt.Color color)
          Sets pressed button background color.
 void setPressedBorderColor(java.awt.Color color)
          Sets pressed button border color.
 void setRolloverBackgroundColor(java.awt.Color color)
          Sets rollover button background color.
 void setRolloverBorderColor(java.awt.Color color)
          Sets rollover button border color.
 void setScrollbar(javax.swing.JScrollBar scrollbar)
          Sets scroll bar which uses this button.
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, getPreferredSize, install, isOpaque, p, removePainterListener, repaint, repaint, repaint, revalidate, setMargin, setMargin, setMargin, setOpaque, setPreferredSize, uninstall, updateAll, updateOpacity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.alee.extended.painter.Painter
addPainterListener, getPreferredSize, install, isOpaque, removePainterListener, uninstall
 

Field Detail

ARROW_BUTTON_SHAPE

protected static final java.lang.String ARROW_BUTTON_SHAPE
Shape cache key.

See Also:
Constant Field Values

borderColor

protected java.awt.Color borderColor
Style settings.


backgroundColor

protected java.awt.Color backgroundColor

disabledBorderColor

protected java.awt.Color disabledBorderColor

disabledBackgroundColor

protected java.awt.Color disabledBackgroundColor

rolloverBorderColor

protected java.awt.Color rolloverBorderColor

rolloverBackgroundColor

protected java.awt.Color rolloverBackgroundColor

pressedBorderColor

protected java.awt.Color pressedBorderColor

pressedBackgroundColor

protected java.awt.Color pressedBackgroundColor

buttonType

protected ScrollBarButtonType buttonType
Runtime variables.


scrollbar

protected javax.swing.JScrollBar scrollbar
Constructor Detail

WebScrollBarButtonPainter

public WebScrollBarButtonPainter()
Constructs new scroll bar button painter.

Method Detail

getBorderColor

public java.awt.Color getBorderColor()
Returns button border color.

Returns:
button border color

setBorderColor

public void setBorderColor(java.awt.Color color)
Sets button border color.

Parameters:
color - new button border color

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns button background color.

Returns:
button background color

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Sets button background color.

Parameters:
color - new button background color

getDisabledBorderColor

public java.awt.Color getDisabledBorderColor()
Returns disabled button border color.

Returns:
disabled button border color

setDisabledBorderColor

public void setDisabledBorderColor(java.awt.Color color)
Sets disabled button border color.

Parameters:
color - new disabled button border color

getDisabledBackgroundColor

public java.awt.Color getDisabledBackgroundColor()
Returns disabled button background color.

Returns:
disabled button background color

setDisabledBackgroundColor

public void setDisabledBackgroundColor(java.awt.Color color)
Sets disabled button background color.

Parameters:
color - new disabled button background color

getRolloverBorderColor

public java.awt.Color getRolloverBorderColor()
Returns rollover button border color.

Returns:
rollover button border color

setRolloverBorderColor

public void setRolloverBorderColor(java.awt.Color color)
Sets rollover button border color.

Parameters:
color - new rollover button border color

getRolloverBackgroundColor

public java.awt.Color getRolloverBackgroundColor()
Returns rollover button background color.

Returns:
rollover button background color

setRolloverBackgroundColor

public void setRolloverBackgroundColor(java.awt.Color color)
Sets rollover button background color.

Parameters:
color - new rollover button background color

getPressedBorderColor

public java.awt.Color getPressedBorderColor()
Returns pressed button border color.

Returns:
pressed button border color

setPressedBorderColor

public void setPressedBorderColor(java.awt.Color color)
Sets pressed button border color.

Parameters:
color - new pressed button border color

getPressedBackgroundColor

public java.awt.Color getPressedBackgroundColor()
Returns pressed button background color.

Returns:
pressed button background color

setPressedBackgroundColor

public void setPressedBackgroundColor(java.awt.Color color)
Sets pressed button background color.

Parameters:
color - new pressed button background color

setButtonType

public void setButtonType(ScrollBarButtonType type)
Sets scroll bar button type.

Specified by:
setButtonType in interface ScrollBarButtonPainter<E extends javax.swing.AbstractButton>
Parameters:
type - scroll bar button type

setScrollbar

public void setScrollbar(javax.swing.JScrollBar scrollbar)
Sets scroll bar which uses this button.

Specified by:
setScrollbar in interface ScrollBarButtonPainter<E extends javax.swing.AbstractButton>
Parameters:
scrollbar - scroll bar which uses this button

getMargin

public java.awt.Insets getMargin(E button)
Returns margin required for visual data provided by this painter. This margin is usually added to component's margin when the final component border is calculated. You may pass null instead of zero margin - it will simply be ignored in that case.

Specified by:
getMargin in interface Painter<E extends javax.swing.AbstractButton>
Overrides:
getMargin in class AbstractPainter<E extends javax.swing.AbstractButton>
Parameters:
button - component to process
Returns:
margin required for visual data provided by this painter or null for zero margin

paint

public void paint(java.awt.Graphics2D g2d,
                  java.awt.Rectangle bounds,
                  E button)
Paints visual data onto the component graphics. Provided graphics and component are taken directly from component UI paint method. Provided bounds are usually fake (zero location, component size) but in some cases it might be specified by componentUI.

Specified by:
paint in interface Painter<E extends javax.swing.AbstractButton>
Parameters:
g2d - component graphics
bounds - bounds for painter visual data
button - component to process

getArrowButtonShape

protected java.awt.Shape getArrowButtonShape(java.awt.Rectangle bounds,
                                             E button)
Returns popup border shape.

Parameters:
bounds - button bounds
button - button component
Returns:
popup border shape

getCachedShapeSettings

protected java.lang.Object[] getCachedShapeSettings(E button)
Returns an array of shape settings cached along with the shape.

Parameters:
button - button component
Returns:
an array of shape settings cached along with the shape

createArrowButtonShape

protected java.awt.Shape createArrowButtonShape(java.awt.Rectangle bounds,
                                                E button)
Returns arrow button shape.

Parameters:
bounds - button bounds
button - button component
Returns:
arrow button shape