E - component typepublic class NinePatchStatePainter<E extends javax.swing.JComponent> extends AbstractPainter<E>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,NinePatchIcon> |
stateIcons
Map containing separate 9-patch icons for different component states.
|
listeners, margin, opaque, preferredSize| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
addPainterListener, install, isOpaque, p, removePainterListener, repaint, repaint, repaint, revalidate, setMargin, setMargin, setMargin, setOpaque, setPreferredSize, uninstall, updateAll, updateOpacityprotected java.util.Map<java.lang.String,NinePatchIcon> stateIcons
public NinePatchStatePainter()
public NinePatchStatePainter(java.util.Map<java.lang.String,NinePatchIcon> stateIcons)
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 processprotected NinePatchIcon getComponentBackground(E component)
component - component to processprotected NinePatchIcon getButtonBackground(javax.swing.AbstractButton button)
button - button to processprotected NinePatchIcon getToolBarBackground(javax.swing.JToolBar toolbar)
toolbar - toolbar to processpublic NinePatchIcon getExactStateIcon(java.lang.String state)
state - component statepublic NinePatchIcon getStateIcon(java.lang.String state)
state - component statepublic 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 processpublic java.awt.Insets getMargin(E c)