|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.border.AbstractBorder
javax.swing.border.LineBorder
public class LineBorder
A border that consists of a line whose thickness and color can be specified. There also is a variant with rounded corners.
| Field Summary | |
|---|---|
protected Color |
lineColor
The color of the line. |
protected boolean |
roundedCorners
Indicates whether the line is drawn with rounded corners ( true) or not ((false). |
protected int |
thickness
The width of the line in pixels. |
| Constructor Summary | |
|---|---|
LineBorder(Color color)
Constructs a LineBorder given its color. |
|
LineBorder(Color color,
int thickness)
Constructs a LineBorder given its color and thickness. |
|
LineBorder(Color color,
int thickness,
boolean roundedCorners)
Constructs a LineBorder given its color, thickness, and whether it has rounded corners. |
|
| Method Summary | |
|---|---|
static Border |
createBlackLineBorder()
Returns a black, one pixel thick, plain LineBorder. |
static Border |
createGrayLineBorder()
Returns a gray, one pixel thick, plain LineBorder. |
Insets |
getBorderInsets(Component c)
Measures the width of this border. |
Insets |
getBorderInsets(Component c,
Insets insets)
Measures the width of this border, storing the results into a pre-existing Insets object. |
Color |
getLineColor()
Returns the color of the line. |
boolean |
getRoundedCorners()
Returns whether this LineBorder os drawm with rounded or with plain corners. |
int |
getThickness()
Returns the thickness of the line in pixels. |
boolean |
isBorderOpaque()
Determines whether this border fills every pixel in its area when painting. |
void |
paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height)
Paints the line border around a given Component. |
| Methods inherited from class javax.swing.border.AbstractBorder |
|---|
getInteriorRectangle, getInteriorRectangle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int thickness
protected Color lineColor
protected boolean roundedCorners
true) or not ((false).
| Constructor Detail |
|---|
public LineBorder(Color color)
color - the color for drawing the border.LineBorder(java.awt.Color, int, boolean)
public LineBorder(Color color,
int thickness)
color - the color for drawing the border.thickness - the width of the line in pixels.LineBorder(java.awt.Color, int, boolean)
public LineBorder(Color color,
int thickness,
boolean roundedCorners)
Note that the enlarged view in the right-hand picture shows
that the implementation draws one more pixel than specified,
provided that roundedCorders is true
and anti-aliasing is turned on while painting. While this might
be considered a bug, the Sun reference implementation (at least
JDK 1.3.1 on Apple MacOS X 10.1.5) can be observed to fill
exactly the same pixels as shown above. The GNU Classpath
LineBorder replicates the observed behavior of the Sun
implementation.
color - the color for drawing the border.thickness - the width of the line in pixels.roundedCorners - true for rounded corners,
false for plain corners.| Method Detail |
|---|
public static Border createBlackLineBorder()
LineBorder. The method
may always return the same (singleton) LineBorder instance.
public static Border createGrayLineBorder()
LineBorder. The method
may always return the same (singleton) LineBorder instance.
public void paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height)
paintBorder in interface BorderpaintBorder in class AbstractBorderc - the component whose border is to be painted.g - the graphics for painting.x - the horizontal position for painting the border.y - the vertical position for painting the border.width - the width of the available area for painting the border.height - the height of the available area for painting the border.public Insets getBorderInsets(Component c)
getBorderInsets in interface BordergetBorderInsets in class AbstractBorderc - the component whose border is to be measured.
left, right,
top and bottom fields indicate the
width of the border at the respective edge, which is the
thickness of the line.getBorderInsets(java.awt.Component, java.awt.Insets)
public Insets getBorderInsets(Component c,
Insets insets)
getBorderInsets in class AbstractBorderinsets - an Insets object for holding the result values.
After invoking this method, the left,
right, top and
bottom fields indicate the width of the
border at the respective edge, which is the thickness
of the line.c - the component that the border applies to (ignored here,
subclasses may use it).
insets.getBorderInsets(Component)public Color getLineColor()
null).public int getThickness()
public boolean getRoundedCorners()
true if the corners are rounded,
false if the corners are plain.public boolean isBorderOpaque()
isBorderOpaque in interface BorderisBorderOpaque in class AbstractBordertrue if the corners are plain and the line
color is fully opaque; false if the corners
are rounded or the line color is partially transparent.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||