com.alee.managers.style.skin.ninepatch
Class NPScrollBarPainter<E extends javax.swing.JScrollBar>

java.lang.Object
  extended by com.alee.extended.painter.AbstractPainter<E>
      extended by com.alee.managers.style.skin.web.WebScrollBarPainter<E>
          extended by com.alee.managers.style.skin.ninepatch.NPScrollBarPainter<E>
All Implemented Interfaces:
Painter<E>, SpecificPainter, ScrollBarPainter<E>

public class NPScrollBarPainter<E extends javax.swing.JScrollBar>
extends WebScrollBarPainter<E>

Base 9-patch painter for JScrollBar component.

Author:
Mikle Garin

Field Summary
protected  boolean focused
           
protected  FocusTracker focusTracker
          Runtime variables.
protected  NinePatchIcon hBackgroundIcon
          Used 9-patch icons.
protected  NinePatchIcon hFocusedBackgroundIcon
           
protected  NinePatchIcon hFocusedThumbIcon
           
protected  NinePatchIcon hFocusedTrackIcon
           
protected  NinePatchIcon hPressedThumbIcon
           
protected  NinePatchIcon hThumbIcon
           
protected  NinePatchIcon hTrackIcon
           
protected  NinePatchIcon vBackgroundIcon
           
protected  NinePatchIcon vFocusedBackgroundIcon
           
protected  NinePatchIcon vFocusedThumbIcon
           
protected  NinePatchIcon vFocusedTrackIcon
           
protected  NinePatchIcon vPressedThumbIcon
           
protected  NinePatchIcon vThumbIcon
           
protected  NinePatchIcon vTrackIcon
           
 
Fields inherited from class com.alee.managers.style.skin.web.WebScrollBarPainter
animated, dragged, mouseAdapter, paintButtons, paintTrack, pressed, rollover, rolloverAnimator, rolloverState, thumbBackgroundColor, thumbBorderColor, thumbBounds, thumbDisabledBackgroundColor, thumbDisabledBorderColor, thumbMargin, thumbMarginHL, thumbMarginHR, thumbMarginR, thumbPressedBackgroundColor, thumbPressedBorderColor, thumbRolloverBackgroundColor, thumbRolloverBorderColor, thumbRound, trackBackgroundColor, trackBorderColor, trackBounds
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
NPScrollBarPainter()
           
 
Method Summary
protected  NinePatchIcon getCurrentBackgroundIcon(E scrollbar)
          Returns background 9-patch icon that should be painted right now.
protected  NinePatchIcon getCurrentThumbIcon(E scrollbar)
          Returns thumb 9-patch icon that should be painted right now.
protected  NinePatchIcon getCurrentTrackIcon(E scrollbar)
          Returns track 9-patch icon that should be painted right now.
 NinePatchIcon getHBackgroundIcon()
          Returns horizontal scroll bar background icon.
 NinePatchIcon getHFocusedBackgroundIcon()
          Returns horizontal scroll bar focused background icon.
 NinePatchIcon getHFocusedThumbIcon()
          Returns horizontal scroll bar focused thumb icon.
 NinePatchIcon getHFocusedTrackIcon()
          Returns horizontal scroll bar focused track background icon.
 NinePatchIcon getHPressedThumbIcon()
          Returns horizontal scroll bar pressed thumb icon.
 NinePatchIcon getHThumbIcon()
          Returns horizontal scroll bar thumb icon.
 NinePatchIcon getHTrackIcon()
          Returns horizontal scroll bar track background icon.
 NinePatchIcon getVBackgroundIcon()
          Returns vertical scroll bar background icon.
 NinePatchIcon getVFocusedBackgroundIcon()
          Returns vertical scroll bar focused background icon.
 NinePatchIcon getVFocusedThumbIcon()
          Returns vertical scroll bar focused thumb icon.
 NinePatchIcon getVFocusedTrackIcon()
          Returns vertical scroll bar focused track background icon.
 NinePatchIcon getVPressedThumbIcon()
          Returns vertical scroll bar pressed thumb icon.
 NinePatchIcon getVThumbIcon()
          Returns vertical scroll bar thumb icon.
 NinePatchIcon getVTrackIcon()
          Returns vertical scroll bar track background icon.
 void install(E c)
          Called when painter is intalled into some component.
protected  void paintBackground(java.awt.Graphics2D g2d, E scrollbar, java.awt.Rectangle b)
          Paints scroll bar background.
protected  void paintThumb(java.awt.Graphics2D g2d, E scrollbar, java.awt.Rectangle b)
          Paints scroll bar thumb.
protected  void paintTrack(java.awt.Graphics2D g2d, E scrollbar, java.awt.Rectangle b)
          Paints scroll bar track.
 void setHBackgroundIcon(NinePatchIcon icon)
          Sets horizontal scroll bar background icon.
 void setHFocusedBackgroundIcon(NinePatchIcon icon)
          Sets horizontal scroll bar focused background icon.
 void setHFocusedThumbIcon(NinePatchIcon icon)
          Sets horizontal scroll bar focused thumb icon.
 void setHFocusedTrackIcon(NinePatchIcon icon)
          Sets horizontal scroll bar focused track background icon.
 void setHPressedThumbIcon(NinePatchIcon icon)
          Sets horizontal scroll bar pressed thumb icon.
 void setHThumbIcon(NinePatchIcon icon)
          Sets horizontal scroll bar thumb icon.
 void setHTrackIcon(NinePatchIcon icon)
          Sets horizontal scroll bar track background icon.
 void setVBackgroundIcon(NinePatchIcon icon)
          Sets vertical scroll bar background icon.
 void setVFocusedBackgroundIcon(NinePatchIcon icon)
          Sets vertical scroll bar focused background icon.
 void setVFocusedThumbIcon(NinePatchIcon icon)
          Sets vertical scroll bar focused thumb icon.
 void setVFocusedTrackIcon(NinePatchIcon icon)
          Sets vertical scroll bar focused track background icon.
 void setVPressedThumbIcon(NinePatchIcon icon)
          Sets vertical scroll bar pressed thumb icon.
 void setVThumbIcon(NinePatchIcon icon)
          Sets vertical scroll bar thumb icon.
 void setVTrackIcon(NinePatchIcon icon)
          Sets vertical scroll bar track background icon.
 void uninstall(E c)
          Called when painter is intalled into some component.
 
Methods inherited from class com.alee.managers.style.skin.web.WebScrollBarPainter
getCurrentThumbBackgroundColor, getCurrentThumbBorderColor, getCurrentThumbMargin, getMargin, getThumbBackgroundColor, getThumbBorderColor, getThumbDisabledBackgroundColor, getThumbDisabledBorderColor, getThumbMargin, getThumbPressedBackgroundColor, getThumbPressedBorderColor, getThumbRolloverBackgroundColor, getThumbRolloverBorderColor, getThumbRound, getTrackBackgroundColor, getTrackBorderColor, isOpaque, isPaintButtons, isPaintTrack, isPressed, isRollover, paint, repaintThumb, setDragged, setPaintButtons, setPaintTrack, setPressed, setRollover, setThumbBackgroundColor, setThumbBorderColor, setThumbBounds, setThumbDisabledBackgroundColor, setThumbDisabledBorderColor, setThumbMargin, setThumbPressedBackgroundColor, setThumbPressedBorderColor, setThumbRolloverBackgroundColor, setThumbRolloverBorderColor, setThumbRound, setTrackBackgroundColor, setTrackBorderColor, setTrackBounds, updateThumbMargins
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, getPreferredSize, p, removePainterListener, repaint, repaint, repaint, revalidate, setMargin, setMargin, setMargin, setOpaque, setPreferredSize, 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, removePainterListener
 

Field Detail

hBackgroundIcon

protected NinePatchIcon hBackgroundIcon
Used 9-patch icons.


hFocusedBackgroundIcon

protected NinePatchIcon hFocusedBackgroundIcon

hTrackIcon

protected NinePatchIcon hTrackIcon

hFocusedTrackIcon

protected NinePatchIcon hFocusedTrackIcon

hThumbIcon

protected NinePatchIcon hThumbIcon

hFocusedThumbIcon

protected NinePatchIcon hFocusedThumbIcon

hPressedThumbIcon

protected NinePatchIcon hPressedThumbIcon

vBackgroundIcon

protected NinePatchIcon vBackgroundIcon

vFocusedBackgroundIcon

protected NinePatchIcon vFocusedBackgroundIcon

vTrackIcon

protected NinePatchIcon vTrackIcon

vFocusedTrackIcon

protected NinePatchIcon vFocusedTrackIcon

vThumbIcon

protected NinePatchIcon vThumbIcon

vFocusedThumbIcon

protected NinePatchIcon vFocusedThumbIcon

vPressedThumbIcon

protected NinePatchIcon vPressedThumbIcon

focusTracker

protected FocusTracker focusTracker
Runtime variables.


focused

protected boolean focused
Constructor Detail

NPScrollBarPainter

public NPScrollBarPainter()
Method Detail

install

public void install(E c)
Called when painter is intalled into some component. You might want to use this method to add custom component listeners or modify component settings.

Specified by:
install in interface Painter<E extends javax.swing.JScrollBar>
Overrides:
install in class WebScrollBarPainter<E extends javax.swing.JScrollBar>
Parameters:
c - component to process

uninstall

public void uninstall(E c)
Called when painter is intalled into some component. You might want to use this method to add custom component listeners or modify component settings.

Specified by:
uninstall in interface Painter<E extends javax.swing.JScrollBar>
Overrides:
uninstall in class WebScrollBarPainter<E extends javax.swing.JScrollBar>
Parameters:
c - component to process

getHBackgroundIcon

public NinePatchIcon getHBackgroundIcon()
Returns horizontal scroll bar background icon. It is painted within scroll bar bounds.

Returns:
horizontal scroll bar background icon

setHBackgroundIcon

public void setHBackgroundIcon(NinePatchIcon icon)
Sets horizontal scroll bar background icon. It is painted within scroll bar bounds.

Parameters:
icon - horizontal scroll bar background icon

getHFocusedBackgroundIcon

public NinePatchIcon getHFocusedBackgroundIcon()
Returns horizontal scroll bar focused background icon. It is painted within scroll bar bounds when it is focused. If set to null hBackgroundIcon is painted instead.

Returns:
horizontal scroll bar focused background icon

setHFocusedBackgroundIcon

public void setHFocusedBackgroundIcon(NinePatchIcon icon)
Sets horizontal scroll bar focused background icon. It is painted within scroll bar bounds when it is focused. If set to null hBackgroundIcon is painted instead.

Parameters:
icon - horizontal scroll bar focused background icon

getHTrackIcon

public NinePatchIcon getHTrackIcon()
Returns horizontal scroll bar track background icon. It is painted within scroll bar track bounds provided by the UI.

Returns:
horizontal scroll bar track background icon

setHTrackIcon

public void setHTrackIcon(NinePatchIcon icon)
Sets horizontal scroll bar track background icon. It is painted within scroll bar track bounds provided by the UI.

Parameters:
icon - horizontal scroll bar track background icon

getHFocusedTrackIcon

public NinePatchIcon getHFocusedTrackIcon()
Returns horizontal scroll bar focused track background icon. It is painted within scroll bar track bounds provided by the UI. If set to null hTrackIcon is painted instead.

Returns:
horizontal scroll bar focused track background icon

setHFocusedTrackIcon

public void setHFocusedTrackIcon(NinePatchIcon icon)
Sets horizontal scroll bar focused track background icon. It is painted within scroll bar track bounds provided by the UI. If set to null hTrackIcon is painted instead.

Parameters:
icon - horizontal scroll bar focused track background icon

getHThumbIcon

public NinePatchIcon getHThumbIcon()
Returns horizontal scroll bar thumb icon. It is painted within scroll bar thumb bounds provided by the UI.

Returns:
horizontal scroll bar thumb icon

setHThumbIcon

public void setHThumbIcon(NinePatchIcon icon)
Sets horizontal scroll bar thumb icon. It is painted within scroll bar thumb bounds provided by the UI.

Parameters:
icon - horizontal scroll bar thumb icon

getHFocusedThumbIcon

public NinePatchIcon getHFocusedThumbIcon()
Returns horizontal scroll bar focused thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null hThumbIcon is painted instead.

Returns:
horizontal scroll bar focused thumb icon

setHFocusedThumbIcon

public void setHFocusedThumbIcon(NinePatchIcon icon)
Sets horizontal scroll bar focused thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null hThumbIcon is painted instead.

Parameters:
icon - horizontal scroll bar focused thumb icon

getHPressedThumbIcon

public NinePatchIcon getHPressedThumbIcon()
Returns horizontal scroll bar pressed thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null hFocusedThumbIcon or hThumbIcon are painted instead.

Returns:
horizontal scroll bar pressed thumb icon

setHPressedThumbIcon

public void setHPressedThumbIcon(NinePatchIcon icon)
Sets horizontal scroll bar pressed thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null hFocusedThumbIcon or hThumbIcon are painted instead.

Parameters:
icon - horizontal scroll bar pressed thumb icon

getVBackgroundIcon

public NinePatchIcon getVBackgroundIcon()
Returns vertical scroll bar background icon. It is painted within scroll bar bounds.

Returns:
vertical scroll bar background icon

setVBackgroundIcon

public void setVBackgroundIcon(NinePatchIcon icon)
Sets vertical scroll bar background icon. It is painted within scroll bar bounds.

Parameters:
icon - vertical scroll bar background icon

getVFocusedBackgroundIcon

public NinePatchIcon getVFocusedBackgroundIcon()
Returns vertical scroll bar focused background icon. It is painted within scroll bar bounds when it is focused. If set to null vBackgroundIcon is painted instead.

Returns:
vertical scroll bar focused background icon

setVFocusedBackgroundIcon

public void setVFocusedBackgroundIcon(NinePatchIcon icon)
Sets vertical scroll bar focused background icon. It is painted within scroll bar bounds when it is focused. If set to null vBackgroundIcon is painted instead.

Parameters:
icon - vertical scroll bar focused background icon

getVTrackIcon

public NinePatchIcon getVTrackIcon()
Returns vertical scroll bar track background icon. It is painted within scroll bar track bounds provided by the UI.

Returns:
vertical scroll bar track background icon

setVTrackIcon

public void setVTrackIcon(NinePatchIcon icon)
Sets vertical scroll bar track background icon. It is painted within scroll bar track bounds provided by the UI.

Parameters:
icon - vertical scroll bar track background icon

getVFocusedTrackIcon

public NinePatchIcon getVFocusedTrackIcon()
Returns vertical scroll bar focused track background icon. It is painted within scroll bar track bounds provided by the UI. If set to null vTrackIcon is painted instead.

Returns:
vertical scroll bar focused track background icon

setVFocusedTrackIcon

public void setVFocusedTrackIcon(NinePatchIcon icon)
Sets vertical scroll bar focused track background icon. It is painted within scroll bar track bounds provided by the UI. If set to null vTrackIcon is painted instead.

Parameters:
icon - vertical scroll bar focused track background icon

getVThumbIcon

public NinePatchIcon getVThumbIcon()
Returns vertical scroll bar thumb icon. It is painted within scroll bar thumb bounds provided by the UI.

Returns:
vertical scroll bar thumb icon

setVThumbIcon

public void setVThumbIcon(NinePatchIcon icon)
Sets vertical scroll bar thumb icon. It is painted within scroll bar thumb bounds provided by the UI.

Parameters:
icon - vertical scroll bar thumb icon

getVFocusedThumbIcon

public NinePatchIcon getVFocusedThumbIcon()
Returns vertical scroll bar focused thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null vThumbIcon is painted instead.

Returns:
vertical scroll bar focused thumb icon

setVFocusedThumbIcon

public void setVFocusedThumbIcon(NinePatchIcon icon)
Sets vertical scroll bar focused thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null vThumbIcon is painted instead.

Parameters:
icon - vertical scroll bar focused thumb icon

getVPressedThumbIcon

public NinePatchIcon getVPressedThumbIcon()
Returns vertical scroll bar pressed thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null vFocusedThumbIcon or vThumbIcon are painted instead.

Returns:
vertical scroll bar pressed thumb icon

setVPressedThumbIcon

public void setVPressedThumbIcon(NinePatchIcon icon)
Sets vertical scroll bar pressed thumb icon. It is painted within scroll bar thumb bounds provided by the UI. If set to null vFocusedThumbIcon or vThumbIcon are painted instead.

Parameters:
icon - vertical scroll bar pressed thumb icon

paintBackground

protected void paintBackground(java.awt.Graphics2D g2d,
                               E scrollbar,
                               java.awt.Rectangle b)
Paints scroll bar background. Background area includes the space under arrow buttons.

Overrides:
paintBackground in class WebScrollBarPainter<E extends javax.swing.JScrollBar>
Parameters:
g2d - graphics context
scrollbar - scroll bar
b - scroll bar bounds

getCurrentBackgroundIcon

protected NinePatchIcon getCurrentBackgroundIcon(E scrollbar)
Returns background 9-patch icon that should be painted right now.

Parameters:
scrollbar - painted scrollbar
Returns:
background 9-patch icon that should be painted right now

paintTrack

protected void paintTrack(java.awt.Graphics2D g2d,
                          E scrollbar,
                          java.awt.Rectangle b)
Paints scroll bar track. Track area only excludes the space under arrow buttons.

Overrides:
paintTrack in class WebScrollBarPainter<E extends javax.swing.JScrollBar>
Parameters:
g2d - graphics context
scrollbar - scroll bar
b - track bounds

getCurrentTrackIcon

protected NinePatchIcon getCurrentTrackIcon(E scrollbar)
Returns track 9-patch icon that should be painted right now.

Parameters:
scrollbar - painted scrollbar
Returns:
track 9-patch icon that should be painted right now

paintThumb

protected void paintThumb(java.awt.Graphics2D g2d,
                          E scrollbar,
                          java.awt.Rectangle b)
Paints scroll bar thumb. Thumb area is limited to thumb bounds and might be changed frequently.

Overrides:
paintThumb in class WebScrollBarPainter<E extends javax.swing.JScrollBar>
Parameters:
g2d - graphics context
scrollbar - scroll bar component
b - thumb bounds

getCurrentThumbIcon

protected NinePatchIcon getCurrentThumbIcon(E scrollbar)
Returns thumb 9-patch icon that should be painted right now.

Parameters:
scrollbar - painted scrollbar
Returns:
thumb 9-patch icon that should be painted right now