javax.swing.border
Class EtchedBorder
- Border, Serializable
A border that looks like an engraving etched into the background
surface, or (in its raised variant) coming out of the surface
plane. Using different constructors, it is possible to either
explicitly specify the border colors, or to let the colors derive
from the background color of the enclosed Component.
static int | LOWERED - Indicates that the border appears as engraved into the
background.
|
static int | RAISED - Indicates that the border appears as coming out of the
background.
|
protected int | etchType - The type of this EtchedBorder, which is either
RAISED
or LOWERED .
|
protected Color | highlight - The highlight color, or
null to indicate that the
color shall be derived from the background of the enclosed
component.
|
protected Color | shadow - The shadow color, or
null to indicate that the
color shall be derived from the background of the enclosed
component.
|
EtchedBorder() - Constructs a lowered EtchedBorder.
|
EtchedBorder(int etchType) - Constructs an EtchedBorder with the specified appearance.
|
EtchedBorder(int etchType, Color highlight, Color shadow) - Constructs an EtchedBorder with the specified appearance,
explicitly selecting the colors that will be used for
highlight and shadow.
|
EtchedBorder(Color highlight, Color shadow) - Constructs a lowered EtchedBorder, explicitly selecting the
colors that will be used for highlight and shadow.
|
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.
|
int | getEtchType() - Returns the appearance of this EtchedBorder, which is either
RAISED or LOWERED .
|
Color | getHighlightColor() - Returns the color that will be used for highlighted parts when
painting the border, or
null if that color will be
derived from the background of the enclosed Component.
|
Color | getHighlightColor(Component c) - Determines the color that will be used for highlighted parts when
painting the border around a given component.
|
Color | getShadowColor() - Returns the color that will be used for shadowed parts when
painting the border, or
null if that color will be
derived from the background of the enclosed Component.
|
Color | getShadowColor(Component c) - Determines the color that will be used for shadowed parts when
painting the border around a given component.
|
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 border for a given component.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
LOWERED
public static final int LOWERED
Indicates that the border appears as engraved into the
background.
RAISED
public static final int RAISED
Indicates that the border appears as coming out of the
background.
highlight
protected Color highlight
The highlight color, or null
to indicate that the
color shall be derived from the background of the enclosed
component.
shadow
protected Color shadow
The shadow color, or null
to indicate that the
color shall be derived from the background of the enclosed
component.
EtchedBorder
public EtchedBorder()
Constructs a lowered EtchedBorder. The colors will be derived
from the background color of the enclosed Component when the
border gets painted.
EtchedBorder
public EtchedBorder(int etchType)
Constructs an EtchedBorder with the specified appearance. The
colors will be derived from the background color of the enclosed
Component when the border gets painted.
etchType
- the desired appearance of the border. The value
must be either RAISED
or LOWERED
.
EtchedBorder
public EtchedBorder(int etchType,
Color highlight,
Color shadow)
Constructs an EtchedBorder with the specified appearance,
explicitly selecting the colors that will be used for
highlight and shadow.
etchType
- the desired appearance of the border. The value
must be either RAISED
or LOWERED
.highlight
- the color that will be used for painting
the highlight part of the border.shadow
- the color that will be used for painting
the shadow part of the border.
EtchedBorder
public EtchedBorder(Color highlight,
Color shadow)
Constructs a lowered EtchedBorder, explicitly selecting the
colors that will be used for highlight and shadow.
highlight
- the color that will be used for painting
the highlight part of the border.shadow
- the color that will be used for painting
the shadow part of the border.
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.
- the same object that was passed for
insets
.
getHighlightColor
public Color getHighlightColor()
Returns the color that will be used for highlighted parts when
painting the border, or null
if that color will be
derived from the background of the enclosed Component.
- The highlight color (possibly
null
).
getHighlightColor
public Color getHighlightColor(Component c)
Determines the color that will be used for highlighted parts when
painting the border around a given component. If a highlight
color has been specified upon constructing the border, that color
is returned. Otherwise, the background color of the enclosed
component is brightened.
c
- the component enclosed by this border.
getShadowColor
public Color getShadowColor()
Returns the color that will be used for shadowed parts when
painting the border, or null
if that color will be
derived from the background of the enclosed Component.
- The shadow color (possibly
null
).
getShadowColor
public Color getShadowColor(Component c)
Determines the color that will be used for shadowed parts when
painting the border around a given component. If a shadow color
has been specified upon constructing the border, that color is
returned. Otherwise, the background color of the enclosed
component is darkened.
c
- the component enclosed by this border.
isBorderOpaque
public boolean isBorderOpaque()
Determines whether this border fills every pixel in its area
when painting.
If the border colors are derived from the background color of
the enclosed component, the result is
true
because
the derivation method always returns opaque colors. Otherwise,
the result depends on the opacity of the individual colors.
- isBorderOpaque in interface Border
- isBorderOpaque in interface AbstractBorder
true
if the border is fully opaque, or
false
if some pixels of the background
can shine through the border.
paintBorder
public void paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height)
Paints the border for 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.
EtchedBorder.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.