public class IconBorder
extends javax.swing.border.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.| Constructor and Description |
|---|
IconBorder(javax.swing.Icon icon)
Creates an IconBorder with an icon.
|
IconBorder(javax.swing.Icon icon,
int verticalIconAlignment)
Creates an IconBorder with an icon.
|
IconBorder(java.awt.Insets borderInsets,
javax.swing.Icon icon)
Creates an IconBorder.
|
IconBorder(int top,
int left,
int bottom,
int right,
javax.swing.Icon icon)
Creates an IconBorder.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getHorizontalIconAlignment()
Gets the icon alignment on the x axis.
|
int |
getVerticalIconAlignment()
Gets the icon alignment on the y axis.
|
void |
paintBorder(java.awt.Component c,
java.awt.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.
|
getBorderInsets, getBorderInsets, getMatteColor, getTileIcon, isBorderOpaquepublic IconBorder(javax.swing.Icon icon)
icon - the icon.public IconBorder(javax.swing.Icon icon,
int verticalIconAlignment)
icon - the icon.verticalIconAlignment - the vertical icon alignment.public IconBorder(java.awt.Insets borderInsets,
javax.swing.Icon icon)
borderInsets - the insets of the border.icon - the iconpublic IconBorder(int top,
int left,
int bottom,
int right,
javax.swing.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(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int width,
int height)
paintBorder in interface javax.swing.border.BorderpaintBorder in class javax.swing.border.MatteBorder