|
||||||||||
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.managers.style.skin.ninepatch.NPDecorationPainter<E>
public class NPDecorationPainter<E extends javax.swing.JComponent>
9-patch partial decoration painter for any kind of components.
This painter is similar to WebDecorationPainter
but this one is based on 9-patch icons.
It uses 9-patch icons for normal and focused component states and its side separators.
WebDecorationPainter
Field Summary | |
---|---|
protected NinePatchIcon |
backgroundIcon
Used 9-patch icons. |
protected NinePatchIcon |
bottomSeparatorIcon
|
protected boolean |
detectSideByContentPatches
|
protected boolean |
focused
|
protected NinePatchIcon |
focusedBackgroundIcon
|
protected FocusTracker |
focusTracker
Runtime variables. |
protected int |
hiddenSideSpacing
|
protected NinePatchIcon |
leftSeparatorIcon
|
protected boolean |
paintBottom
|
protected boolean |
paintBottomLine
|
protected boolean |
paintFocus
|
protected boolean |
paintLeft
|
protected boolean |
paintLeftLine
|
protected boolean |
paintRight
|
protected boolean |
paintRightLine
|
protected boolean |
paintTop
|
protected boolean |
paintTopLine
|
protected NinePatchIcon |
rightSeparatorIcon
|
protected NinePatchIcon |
separatorIcon
|
protected NinePatchIcon |
topSeparatorIcon
|
protected boolean |
undecorated
Style settings. |
Fields inherited from class com.alee.extended.painter.AbstractPainter |
---|
listeners, margin, opaque, preferredSize |
Constructor Summary | |
---|---|
NPDecorationPainter()
|
Method Summary | |
---|---|
protected java.awt.Rectangle |
getBackgroundBounds(NinePatchIcon icon,
java.awt.Rectangle b,
E c)
Returns bounds within which background 9-patch icon should be painted. |
NinePatchIcon |
getBackgroundIcon()
Returns background 9-patch icon. |
NinePatchIcon |
getBottomSeparatorIcon()
Returns bottom side separator 9-patch icon. |
protected NinePatchIcon |
getCurrentBackgroundIcon()
Returns background 9-patch icon that should be painted right now. |
protected NinePatchIcon |
getCurrentBottomSeparatorIcon()
Returns bottom separator 9-patch icon that should be painted according to provided icons. |
protected NinePatchIcon |
getCurrentLeftSeparatorIcon()
Returns left separator 9-patch icon that should be painted according to provided icons. |
protected NinePatchIcon |
getCurrentRightSeparatorIcon()
Returns right separator 9-patch icon that should be painted according to provided icons. |
protected NinePatchIcon |
getCurrentTopSeparatorIcon()
Returns top separator 9-patch icon that should be painted according to provided icons. |
NinePatchIcon |
getFocusedBackgroundIcon()
Returns focused background 9-patch icon. |
int |
getHiddenSideSpacing()
Returns additional spacing provided for side with hidden decoration. |
NinePatchIcon |
getLeftSeparatorIcon()
Returns left side separator 9-patch icon. |
java.awt.Insets |
getMargin(E c)
Returns margin required for visual data provided by this painter. |
NinePatchIcon |
getRightSeparatorIcon()
Returns right side separator 9-patch icon. |
NinePatchIcon |
getSeparatorIcon()
Returns default side separator 9-patch icon. |
NinePatchIcon |
getTopSeparatorIcon()
Sets top side separator 9-patch icon. |
void |
install(E c)
Called when painter is intalled into some component. |
protected boolean |
isAnyLineShouldBePainted()
Returns whether at least one side line should be painted or not. |
protected boolean |
isBottomLineShouldBePainted()
Returns whether bottom side line should be painted or not. |
boolean |
isDetectSideByContentPatches()
Returns whether single decoration side size should be detected by content patches on the image or not. |
protected boolean |
isLeftLineShouldBePainted()
Returns whether left side line should be painted or not. |
boolean |
isPaintBottom()
Returns whether should paint bottom side or not. |
boolean |
isPaintBottomLine()
Returns whether should paint bottom side line or not. |
boolean |
isPaintFocus()
Returns whether focus should be painted or not. |
boolean |
isPaintLeft()
Returns whether should paint left side or not. |
boolean |
isPaintLeftLine()
Returns whether should paint left side line or not. |
boolean |
isPaintRight()
Returns whether should paint right side or not. |
boolean |
isPaintRightLine()
Returns whether should paint right side line or not. |
boolean |
isPaintTop()
Returns whether should paint top side or not. |
boolean |
isPaintTopLine()
Returns whether should paint top side line or not. |
protected boolean |
isRightLineShouldBePainted()
Returns whether right side line should be painted or not. |
protected boolean |
isTopLineShouldBePainted()
Returns whether top side line should be painted or not. |
boolean |
isUndecorated()
Returns whether decoration should be painted or not. |
void |
paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c)
Paints visual data onto the component graphics. |
void |
setBackgroundIcon(NinePatchIcon icon)
Sets background 9-patch icon. |
void |
setBottomSeparatorIcon(NinePatchIcon icon)
Sets bottom side separator 9-patch icon. |
void |
setDetectSideByContentPatches(boolean detectSideByContentPatches)
Set whether single decoration side size should be detected by content patches on the image or not. |
void |
setFocusedBackgroundIcon(NinePatchIcon icon)
Sets focused background 9-patch icon. |
void |
setHiddenSideSpacing(int spacing)
Sets additional spacing provided for side with hidden decoration. |
void |
setLeftSeparatorIcon(NinePatchIcon icon)
Sets left side separator 9-patch icon. |
void |
setPaintBottom(boolean bottom)
Sets whether should paint bottom side or not. |
void |
setPaintBottomLine(boolean bottom)
Sets whether should paint bottom side line or not. |
void |
setPaintFocus(boolean paint)
Sets whether focus should be painted or not. |
void |
setPaintLeft(boolean left)
Sets whether should paint left side or not. |
void |
setPaintLeftLine(boolean left)
Sets whether should paint left side line or not. |
void |
setPaintRight(boolean right)
Sets whether should paint right side or not. |
void |
setPaintRightLine(boolean right)
Sets whether should paint right side line or not. |
void |
setPaintSideLines(boolean top,
boolean left,
boolean bottom,
boolean right)
Sets whether should paint specific side lines or not. |
void |
setPaintSides(boolean top,
boolean left,
boolean bottom,
boolean right)
Sets whether should paint specific sides or not. |
void |
setPaintTop(boolean top)
Sets whether should paint top side or not. |
void |
setPaintTopLine(boolean top)
Sets whether should paint top side line or not. |
void |
setRightSeparatorIcon(NinePatchIcon icon)
Sets right side separator 9-patch icon. |
void |
setSeparatorIcon(NinePatchIcon icon)
Sets default side separator 9-patch icon. |
void |
setTopSeparatorIcon(NinePatchIcon icon)
Sets top side separator 9-patch icon. |
void |
setUndecorated(boolean undecorated)
Sets whether decoration should be painted or not. |
void |
uninstall(E c)
Called when painter is intalled into some component. |
Methods inherited from class com.alee.extended.painter.AbstractPainter |
---|
addPainterListener, getPreferredSize, isOpaque, 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 |
Field Detail |
---|
protected boolean undecorated
protected boolean paintFocus
protected boolean paintTop
protected boolean paintLeft
protected boolean paintBottom
protected boolean paintRight
protected boolean paintTopLine
protected boolean paintLeftLine
protected boolean paintBottomLine
protected boolean paintRightLine
protected boolean detectSideByContentPatches
protected int hiddenSideSpacing
protected NinePatchIcon backgroundIcon
protected NinePatchIcon focusedBackgroundIcon
protected NinePatchIcon separatorIcon
protected NinePatchIcon topSeparatorIcon
protected NinePatchIcon leftSeparatorIcon
protected NinePatchIcon bottomSeparatorIcon
protected NinePatchIcon rightSeparatorIcon
protected FocusTracker focusTracker
protected boolean focused
Constructor Detail |
---|
public NPDecorationPainter()
Method Detail |
---|
public void install(E c)
install
in interface Painter<E extends javax.swing.JComponent>
install
in class AbstractPainter<E extends javax.swing.JComponent>
c
- component to processpublic void uninstall(E c)
uninstall
in interface Painter<E extends javax.swing.JComponent>
uninstall
in class AbstractPainter<E extends javax.swing.JComponent>
c
- component to processpublic boolean isUndecorated()
public void setUndecorated(boolean undecorated)
undecorated
- whether decoration should be painted or notpublic boolean isPaintFocus()
public void setPaintFocus(boolean paint)
paint
- whether focus should be painted or notpublic boolean isPaintTop()
public void setPaintTop(boolean top)
setPaintTop
in interface PartialDecoration
top
- whether should paint top side or notpublic boolean isPaintLeft()
public void setPaintLeft(boolean left)
setPaintLeft
in interface PartialDecoration
left
- whether should paint left side or notpublic boolean isPaintBottom()
public void setPaintBottom(boolean bottom)
setPaintBottom
in interface PartialDecoration
bottom
- whether should paint bottom side or notpublic boolean isPaintRight()
public void setPaintRight(boolean right)
setPaintRight
in interface PartialDecoration
right
- whether should paint right side or notpublic void setPaintSides(boolean top, boolean left, boolean bottom, boolean right)
setPaintSides
in interface PartialDecoration
top
- whether should paint top side or notleft
- whether should paint left side or notbottom
- whether should paint bottom side or notright
- whether should paint right side or notpublic boolean isPaintTopLine()
public void setPaintTopLine(boolean top)
setPaintTopLine
in interface PartialDecoration
top
- whether should paint top side line or notpublic boolean isPaintLeftLine()
public void setPaintLeftLine(boolean left)
setPaintLeftLine
in interface PartialDecoration
left
- whether should paint left side line or notpublic boolean isPaintBottomLine()
public void setPaintBottomLine(boolean bottom)
setPaintBottomLine
in interface PartialDecoration
bottom
- whether should paint bottom side line or notpublic boolean isPaintRightLine()
public void setPaintRightLine(boolean right)
setPaintRightLine
in interface PartialDecoration
right
- whether should paint right side line or notpublic void setPaintSideLines(boolean top, boolean left, boolean bottom, boolean right)
setPaintSideLines
in interface PartialDecoration
top
- whether should paint top side line or notleft
- whether should paint left side line or notbottom
- whether should paint bottom side line or notright
- whether should paint right side line or notpublic boolean isDetectSideByContentPatches()
public void setDetectSideByContentPatches(boolean detectSideByContentPatches)
detectSideByContentPatches
- whether single decoration side size should be detected by content patches on the image or notpublic int getHiddenSideSpacing()
public void setHiddenSideSpacing(int spacing)
spacing
- additional spacing provided for side with hidden decorationpublic NinePatchIcon getBackgroundIcon()
public void setBackgroundIcon(NinePatchIcon icon)
icon
- background 9-patch iconpublic NinePatchIcon getFocusedBackgroundIcon()
public void setFocusedBackgroundIcon(NinePatchIcon icon)
icon
- focused background 9-patch iconpublic NinePatchIcon getSeparatorIcon()
public void setSeparatorIcon(NinePatchIcon icon)
icon
- default side separator 9-patch iconpublic NinePatchIcon getTopSeparatorIcon()
public void setTopSeparatorIcon(NinePatchIcon icon)
icon
- top side separator 9-patch iconpublic NinePatchIcon getLeftSeparatorIcon()
public void setLeftSeparatorIcon(NinePatchIcon icon)
icon
- left side separator 9-patch iconpublic NinePatchIcon getBottomSeparatorIcon()
public void setBottomSeparatorIcon(NinePatchIcon icon)
icon
- bottom side separator 9-patch iconpublic NinePatchIcon getRightSeparatorIcon()
public void setRightSeparatorIcon(NinePatchIcon icon)
icon
- right side separator 9-patch iconpublic 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
public void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E c)
paint
in interface Painter<E extends javax.swing.JComponent>
g2d
- component graphicsbounds
- bounds for painter visual datac
- component to processprotected NinePatchIcon getCurrentBackgroundIcon()
protected NinePatchIcon getCurrentTopSeparatorIcon()
protected NinePatchIcon getCurrentLeftSeparatorIcon()
protected NinePatchIcon getCurrentBottomSeparatorIcon()
protected NinePatchIcon getCurrentRightSeparatorIcon()
protected boolean isAnyLineShouldBePainted()
protected boolean isTopLineShouldBePainted()
protected boolean isLeftLineShouldBePainted()
protected boolean isBottomLineShouldBePainted()
protected boolean isRightLineShouldBePainted()
protected java.awt.Rectangle getBackgroundBounds(NinePatchIcon icon, java.awt.Rectangle b, E c)
icon
- background 9-patch iconb
- component boundsc
- component instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |