javax.swing.border
Class LineBorder
- Border, Serializable
A border that consists of a line whose thickness and color can be
specified. There also is a variant with rounded corners.
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.
|
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.
|
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.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
roundedCorners
protected boolean roundedCorners
Indicates whether the line is drawn with rounded corners
(true
) or not ((false
).
thickness
protected int thickness
The width of the line in pixels.
LineBorder
public LineBorder(Color color)
Constructs a LineBorder given its color. The border will be one
pixel thick and have plain corners.
color
- the color for drawing the border.
LineBorder
public LineBorder(Color color,
int thickness)
Constructs a LineBorder given its color and thickness. The
border will have plain corners.
color
- the color for drawing the border.thickness
- the width of the line in pixels.
LineBorder
public LineBorder(Color color,
int thickness,
boolean roundedCorners)
Constructs a LineBorder given its color, thickness, and whether
it has rounded corners.
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.
getBorderInsets
public Insets getBorderInsets(Component c,
Insets insets)
Measures the width of this border, storing the results into a
pre-existing Insets object.
- getBorderInsets in interface AbstractBorder
insets
- 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.
- the same object that was passed for
insets
.
getLineColor
public Color getLineColor()
Returns the color of the line.
- The line color (never
null
).
getRoundedCorners
public boolean getRoundedCorners()
Returns whether this LineBorder os drawm with rounded
or with plain corners.
true
if the corners are rounded,
false
if the corners are plain.
getThickness
public int getThickness()
Returns the thickness of the line in pixels.
- The line thickness (in pixels).
isBorderOpaque
public boolean isBorderOpaque()
Determines whether this border fills every pixel in its area
when painting.
- isBorderOpaque in interface Border
- isBorderOpaque in interface AbstractBorder
true
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.
paintBorder
public void paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height)
Paints the line border around a given Component.
- paintBorder in interface Border
- paintBorder in interface AbstractBorder
c
- 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.
LineBorder.java --
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.