javax.swing.border
abstract public class: AbstractBorder [javadoc |
source]
java.lang.Object
javax.swing.border.AbstractBorder
All Implemented Interfaces:
Border, Serializable
Direct Known Subclasses:
PopupMenuBorder, RolloverButtonBorder, OptionDialogBorder, ToolBarBorder, RolloverMarginBorder, EmptyBorderUIResource, WarningDialogBorder, MatteBorder, BasicBorder, EmptyBorder, AbstractFlatBorder, FieldBorder, LineBorder, CompoundBorder, SoftBevelBorder, TiledMatteBorder, SynthBorder, ErrorDialogBorder, TitledBorder, CommentBorder, InternalFrameBorder, CSSBorder, RadioButtonBorder, MenuBarBorder, RolloverMarginBorder, ViewportBorder, LineBorderUIResource, TitledBorderUIResource, BevelBorder, PanelBorder, ButtonBorder, BevelBorderUIResource, CompoundBorderUIResource, QuestionDialogBorder, EtchedBorderUIResource, MatteBorderUIResource, ToggleButtonBorder, EtchedBorder, RolloverButtonBorder, MenuItemBorder, ToggleButtonBorder, FlatButtonBorder, EditorBorder, TextFieldBorder, MarginBorder, MenuBarBorder, DialogBorder, TableHeaderBorder, FrameBorder, ScrollPaneBorder, Flush3DBorder, ButtonBorder, PaletteBorder
A class that implements an empty border with no size.
This provides a convenient base class from which other border
classes can be easily derived.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder .
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.swing.border.AbstractBorder Detail: |
public int getBaseline(Component c,
int width,
int height) {
if (width < 0 || height < 0) {
throw new IllegalArgumentException(
"Width and height must be >= 0");
}
return -1;
}
Returns the baseline. A return value less than 0 indicates the border
does not have a reasonable baseline.
The default implementation returns -1. Subclasses that support
baseline should override appropriately. If a value >= 0 is
returned, then the component has a valid baseline for any
size >= the minimum size and getBaselineResizeBehavior
can be used to determine how the baseline changes with size. |
public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c) {
if (c == null) {
throw new NullPointerException("Component must be non-null");
}
return Component.BaselineResizeBehavior.OTHER;
}
Returns an enum indicating how the baseline of a component
changes as the size changes. This method is primarily meant for
layout managers and GUI builders.
The default implementation returns
BaselineResizeBehavior.OTHER, subclasses that support
baseline should override appropriately. Subclasses should
never return null; if the baseline can not be
calculated return BaselineResizeBehavior.OTHER. Callers
should first ask for the baseline using
getBaseline and if a value >= 0 is returned use
this method. It is acceptable for this method to return a
value other than BaselineResizeBehavior.OTHER even if
getBaseline returns a value less than 0. |
public Insets getBorderInsets(Component c) {
return getBorderInsets(c, new Insets(0, 0, 0, 0));
}
This default implementation returns a new Insets object
that is initialized by the #getBorderInsets(Component,Insets)
method.
By default the {@code top}, {@code left}, {@code bottom},
and {@code right} fields are set to {@code 0}. |
public Insets getBorderInsets(Component c,
Insets insets) {
insets.left = insets.top = insets.right = insets.bottom = 0;
return insets;
}
Reinitializes the insets parameter with this Border's current Insets. |
public Rectangle getInteriorRectangle(Component c,
int x,
int y,
int width,
int height) {
return getInteriorRectangle(c, this, x, y, width, height);
}
This convenience method calls the static method. |
public static Rectangle getInteriorRectangle(Component c,
Border b,
int x,
int y,
int width,
int height) {
Insets insets;
if(b != null)
insets = b.getBorderInsets(c);
else
insets = new Insets(0, 0, 0, 0);
return new Rectangle(x + insets.left,
y + insets.top,
width - insets.right - insets.left,
height - insets.top - insets.bottom);
}
Returns a rectangle using the arguments minus the
insets of the border. This is useful for determining the area
that components should draw in that will not intersect the border. |
public boolean isBorderOpaque() {
return false;
}
This default implementation returns false. |
static boolean isLeftToRight(Component c) {
return c.getComponentOrientation().isLeftToRight();
}
|
public void paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height) {
}
This default implementation does no painting. |