APIdia Launch Partner
Top Description Constructors Methods
javax.swing.border

public abstract Class AbstractBorder

extends Object
implements Border, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, javax.swing.border.Border
Known Direct Subclasses
javax.swing.border.BevelBorder, javax.swing.border.CompoundBorder, javax.swing.border.EmptyBorder, javax.swing.border.EtchedBorder, javax.swing.border.LineBorder, javax.swing.border.StrokeBorder, javax.swing.border.TitledBorder, javax.swing.plaf.basic.BasicBorders.ButtonBorder, javax.swing.plaf.basic.BasicBorders.MenuBarBorder, javax.swing.plaf.basic.BasicBorders.MarginBorder, javax.swing.plaf.basic.BasicBorders.FieldBorder, javax.swing.plaf.metal.MetalBorders.Flush3DBorder, javax.swing.plaf.metal.MetalBorders.ButtonBorder, javax.swing.plaf.metal.MetalBorders.AbstractMetalWindowBorder, javax.swing.plaf.metal.MetalBorders.InternalFrameBorder, javax.swing.plaf.metal.MetalBorders.PaletteBorder, javax.swing.plaf.metal.MetalBorders.OptionDialogBorder, javax.swing.plaf.metal.MetalBorders.MenuBarBorder, javax.swing.plaf.metal.MetalBorders.MenuItemBorder, javax.swing.plaf.metal.MetalBorders.PopupMenuBorder, javax.swing.plaf.metal.MetalBorders.ToolBarBorder, javax.swing.plaf.metal.MetalBorders.ScrollPaneBorder, javax.swing.plaf.metal.MetalBorders.TableHeaderBorder, javax.swing.plaf.metal.MetalComboBoxEditor.EditorBorder, javax.swing.plaf.synth.SynthBorder, javax.swing.plaf.synth.SynthScrollPaneUI.ViewportBorder, javax.swing.text.html.CSSBorder, com.sun.java.swing.plaf.gtk.GTKPainter.ListTableFocusBorder, com.sun.java.swing.plaf.gtk.GTKPainter.TitledBorder, com.sun.java.swing.plaf.motif.MotifBorders.BevelBorder, com.sun.java.swing.plaf.motif.MotifBorders.FocusBorder, com.sun.java.swing.plaf.motif.MotifBorders.ButtonBorder, com.sun.java.swing.plaf.motif.MotifBorders.FrameBorder, com.sun.java.swing.plaf.motif.MotifBorders.MotifPopupMenuBorder, sun.awt.X11.XTextAreaPeer.BevelBorder, sun.swing.plaf.synth.SynthFileChooserUI.UIBorder
Annotations
@SuppressWarnings:serial
Imports
java.awt.Graphics, .Insets, .Rectangle, .Component, java.io.Serializable

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 JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
David Kloba

Constructor Summary

AccessConstructor and Description
protected
AbstractBorder()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the baseline or < 0 indicating there is no reasonable baseline
getBaseline
(Component
Component baseline is being requested for
c
,
int
the width to get the baseline for
width
,
int
the height to get the baseline for
height
)

Returns the baseline.

public Component.BaselineResizeBehavior

Returns:

an enum indicating how the baseline changes as the border is resized
getBaselineResizeBehavior
(Component
Component to return baseline resize behavior for
c
)

Returns an enum indicating how the baseline of a component changes as the size changes.

public Insets

Returns:

a new Insets object
getBorderInsets
(Component
the component for which this border insets value applies
c
)

Implements javax.swing.border.Border.getBorderInsets.

This default implementation returns a new Insets object that is initialized by the getBorderInsets(Component, Insets) method.

public Insets

Returns:

the insets object
getBorderInsets
(Component
the component for which this border insets value applies
c
,
Insets
the object to be reinitialized
insets
)

Reinitializes the insets parameter with this Border's current Insets.

public Rectangle

Returns:

a Rectangle containing the interior coordinates
getInteriorRectangle
(Component
the component for which this border is being computed
c
,
int
the x position of the border
x
,
int
the y position of the border
y
,
int
the width of the border
width
,
int
the height of the border
height
)

This convenience method calls the static method.

public static Rectangle

Returns:

a Rectangle containing the interior coordinates
getInteriorRectangle
(Component
the component for which this border is being computed
c
,
Border
the Border object
b
,
int
the x position of the border
x
,
int
the y position of the border
y
,
int
the width of the border
width
,
int
the height of the border
height
)

Returns a rectangle using the arguments minus the insets of the border.

public boolean

Returns:

false
isBorderOpaque
()

Implements javax.swing.border.Border.isBorderOpaque.

This default implementation returns false.

pack-priv static boolean
public void
paintBorder(Component
the component for which this border is being painted
c
,
Graphics
the paint graphics
g
,
int
the x position of the painted border
x
,
int
the y position of the painted border
y
,
int
the width of the painted border
width
,
int
the height of the painted border
height
)

Implements javax.swing.border.Border.paintBorder.

This default implementation does no painting.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractBorderback to summary
protected AbstractBorder()

Constructor for subclasses to call.

Method Detail

getBaselineback to summary
public int getBaseline(Component c, int width, int height)

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.

Parameters
c:Component

Component baseline is being requested for

width:int

the width to get the baseline for

height:int

the height to get the baseline for

Returns:int

the baseline or < 0 indicating there is no reasonable baseline

Exceptions
IllegalArgumentException:
if width or height is < 0
Since
1.6
See Also
java.awt.Component#getBaseline(int, int), java.awt.Component#getBaselineResizeBehavior()
getBaselineResizeBehaviorback to summary
public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)

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.

Parameters
c:Component

Component to return baseline resize behavior for

Returns:Component.BaselineResizeBehavior

an enum indicating how the baseline changes as the border is resized

Exceptions
NullPointerException:
if Component is null
Since
1.6
See Also
java.awt.Component#getBaseline(int, int), java.awt.Component#getBaselineResizeBehavior()
getBorderInsetsback to summary
public Insets getBorderInsets(Component c)

Implements javax.swing.border.Border.getBorderInsets.

This default implementation returns a new Insets object that is initialized by the getBorderInsets(Component, Insets) method. By default the top, left, bottom, and right fields are set to 0.

Parameters
c:Component

the component for which this border insets value applies

Returns:Insets

a new Insets object

getBorderInsetsback to summary
public Insets getBorderInsets(Component c, Insets insets)

Reinitializes the insets parameter with this Border's current Insets.

Parameters
c:Component

the component for which this border insets value applies

insets:Insets

the object to be reinitialized

Returns:Insets

the insets object

Exceptions
NullPointerException:
if the specified insets is null
getInteriorRectangleback to summary
public Rectangle getInteriorRectangle(Component c, int x, int y, int width, int height)

This convenience method calls the static method.

Parameters
c:Component

the component for which this border is being computed

x:int

the x position of the border

y:int

the y position of the border

width:int

the width of the border

height:int

the height of the border

Returns:Rectangle

a Rectangle containing the interior coordinates

getInteriorRectangleback to summary
public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height)

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.

Parameters
c:Component

the component for which this border is being computed

b:Border

the Border object

x:int

the x position of the border

y:int

the y position of the border

width:int

the width of the border

height:int

the height of the border

Returns:Rectangle

a Rectangle containing the interior coordinates

isBorderOpaqueback to summary
public boolean isBorderOpaque()

Implements javax.swing.border.Border.isBorderOpaque.

This default implementation returns false.

Returns:boolean

false

isLeftToRightback to summary
pack-priv static boolean isLeftToRight(Component c)
paintBorderback to summary
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)

Implements javax.swing.border.Border.paintBorder.

This default implementation does no painting.

Parameters
c:Component

the component for which this border is being painted

g:Graphics

the paint graphics

x:int

the x position of the painted border

y:int

the y position of the painted border

width:int

the width of the painted border

height:int

the height of the painted border