|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.extended.painter.AbstractPainter<E> com.alee.extended.painter.NinePatchStatePainter<E>
E
- component typepublic class NinePatchStatePainter<E extends javax.swing.JComponent>
This painter class allows you to specify multiply 9-patch images for different component states. By default there is support for some standard Swing component states like buttons.
ComponentState
,
NinePatchIcon
,
NinePatchIconPainter
,
AbstractPainter
,
Painter
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,NinePatchIcon> |
stateIcons
Map containing separate 9-patch icons for different component states. |
Fields inherited from class com.alee.extended.painter.AbstractPainter |
---|
listeners, margin, opaque, preferredSize |
Constructor Summary | |
---|---|
NinePatchStatePainter()
Constructs new 9-patch state painter with empty states. |
|
NinePatchStatePainter(java.util.Map<java.lang.String,NinePatchIcon> stateIcons)
Constructs new 9-patch state painter with specified states map. |
Method Summary | |
---|---|
void |
addStateIcon(java.lang.String state,
NinePatchIcon ninePatchIcon)
Adds painter state. |
protected NinePatchIcon |
getButtonBackground(javax.swing.AbstractButton button)
Returns current state icon for the specified button. |
protected NinePatchIcon |
getComponentBackground(E component)
Returns current state icon for the specified component. |
NinePatchIcon |
getExactStateIcon(java.lang.String state)
Returns exact state icon or null if it is not specified. |
java.awt.Insets |
getMargin(E c)
Returns margin required for visual data provided by this painter. |
java.awt.Dimension |
getPreferredSize(E c)
Returns preferred size required for proper painting of visual data provided by this painter. |
NinePatchIcon |
getStateIcon(java.lang.String state)
Returns state icon or possible replacement for it. |
java.util.Map<java.lang.String,NinePatchIcon> |
getStateIcons()
Returns states map. |
protected NinePatchIcon |
getToolBarBackground(javax.swing.JToolBar toolbar)
Returns current state icon for the specified toolbar. |
boolean |
hasStateIcons()
Returns whether atleast one state icon is available or not. |
protected boolean |
isFocused(E component)
Returns whether component is in focused state or not. |
void |
paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c)
Paints visual data onto the component graphics. |
void |
removeStateIcon(java.lang.String state)
Removes painter state. |
void |
setStateIcons(java.util.Map<java.lang.String,NinePatchIcon> stateIcons)
Sets states map. |
Methods inherited from class com.alee.extended.painter.AbstractPainter |
---|
addPainterListener, 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 |
Field Detail |
---|
protected java.util.Map<java.lang.String,NinePatchIcon> stateIcons
Constructor Detail |
---|
public NinePatchStatePainter()
public NinePatchStatePainter(java.util.Map<java.lang.String,NinePatchIcon> stateIcons)
Method Detail |
---|
public java.util.Map<java.lang.String,NinePatchIcon> getStateIcons()
public void setStateIcons(java.util.Map<java.lang.String,NinePatchIcon> stateIcons)
stateIcons
- states mappublic void addStateIcon(java.lang.String state, NinePatchIcon ninePatchIcon)
state
- state to addninePatchIcon
- 9-patch iconpublic void removeStateIcon(java.lang.String state)
state
- state to removepublic boolean hasStateIcons()
public void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E c)
g2d
- component graphicsbounds
- bounds for painter visual datac
- component to processprotected boolean isFocused(E component)
component
- component to process
protected NinePatchIcon getComponentBackground(E component)
component
- component to process
protected NinePatchIcon getButtonBackground(javax.swing.AbstractButton button)
button
- button to process
protected NinePatchIcon getToolBarBackground(javax.swing.JToolBar toolbar)
toolbar
- toolbar to process
public NinePatchIcon getExactStateIcon(java.lang.String state)
state
- component state
public NinePatchIcon getStateIcon(java.lang.String state)
state
- component state
public java.awt.Dimension getPreferredSize(E c)
getPreferredSize
in interface Painter<E extends javax.swing.JComponent>
getPreferredSize
in class AbstractPainter<E extends javax.swing.JComponent>
c
- component to process
public java.awt.Insets getMargin(E c)
getMargin
in interface Painter<E extends javax.swing.JComponent>
getMargin
in class AbstractPainter<E extends javax.swing.JComponent>
c
- component to process
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |