Serializable
, Border
public class IconBorder extends MatteBorder
setHorizontalIconAlignment(int)
and set it to TOP or CENTER or BOTTOM.
This border is useful when attempting to add Icons to pre-existing components without requiring specialty painting.
For example, use in the CellStyle to decorate the cell renderer with an icon.bottom, left, right, top
color, tileIcon
Constructor | Description |
---|---|
IconBorder(int top,
int left,
int bottom,
int right,
Icon icon) |
Creates an IconBorder.
|
IconBorder(Insets borderInsets,
Icon icon) |
Creates an IconBorder.
|
IconBorder(Icon icon) |
Creates an IconBorder with an icon.
|
IconBorder(Icon icon,
int verticalIconAlignment) |
Creates an IconBorder with an icon.
|
Modifier and Type | Method | Description |
---|---|---|
int |
getHorizontalIconAlignment() |
Gets the icon alignment on the x axis.
|
int |
getVerticalIconAlignment() |
Gets the icon alignment on the y axis.
|
void |
paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height) |
|
void |
setHorizontalIconAlignment(int horizontalIconAlignment) |
Sets the alignment of the icon relative to the component contents.
|
void |
setVerticalIconAlignment(int verticalIconAlignment) |
Sets the alignment of the icon relative to the component contents.
|
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle
getBorderInsets, getBorderInsets, getMatteColor, getTileIcon, isBorderOpaque
public IconBorder(Icon icon)
icon
- the icon.public IconBorder(Icon icon, int verticalIconAlignment)
icon
- the icon.verticalIconAlignment
- the vertical icon alignment.public IconBorder(Insets borderInsets, Icon icon)
borderInsets
- the insets of the border.icon
- the iconpublic IconBorder(int top, int left, int bottom, int right, Icon icon)
top
- the top inset of the borderleft
- the left inset of the borderbottom
- the bottom inset of the borderright
- the right inset of the bordericon
- the icon.public int getHorizontalIconAlignment()
public void setHorizontalIconAlignment(int horizontalIconAlignment)
horizontalIconAlignment
- one of the five SwingConstants listed above.public int getVerticalIconAlignment()
public void setVerticalIconAlignment(int verticalIconAlignment)
verticalIconAlignment
- one of the three SwingConstants listed above.public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
paintBorder
in interface Border
paintBorder
in class MatteBorder