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

public Class MatteBorder

extends EmptyBorder
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.BorderUIResource.MatteBorderUIResource
Annotations
@SuppressWarnings:serial
Imports
java.awt.Graphics, .Insets, .Component, .Color, javax.swing.Icon

A class which provides a matte-like border of either a solid color or a tiled icon.

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
Amy Fowler

Field Summary

Modifier and TypeField and Description
protected Color
color

The color rendered for the border.

protected Icon
tileIcon

The icon to be used for tiling the border.

Inherited from javax.swing.border.EmptyBorder:
bottomleftrighttop

Constructor Summary

AccessConstructor and Description
public
MatteBorder(int
the top inset of the border
top
,
int
the left inset of the border
left
,
int
the bottom inset of the border
bottom
,
int
the right inset of the border
right
,
Color
the color rendered for the border
matteColor
)

Creates a matte border with the specified insets and color.

public
MatteBorder(Insets
the insets of the border
borderInsets
,
Color
the color rendered for the border
matteColor
)

Creates a matte border with the specified insets and color.

public
MatteBorder(int
the top inset of the border
top
,
int
the left inset of the border
left
,
int
the bottom inset of the border
bottom
,
int
the right inset of the border
right
,
Icon
the icon to be used for tiling the border
tileIcon
)

Creates a matte border with the specified insets and tile icon.

public
MatteBorder(Insets
the insets of the border
borderInsets
,
Icon
the icon to be used for tiling the border
tileIcon
)

Creates a matte border with the specified insets and tile icon.

public
MatteBorder(Icon
the icon to be used for tiling the border
tileIcon
)

Creates a matte border with the specified tile icon.

Method Summary

Modifier and TypeMethod and Description
private Insets
public Insets
getBorderInsets(Component
the component for which this border insets value applies
c
,
Insets
the object to be reinitialized
insets
)

Overrides javax.swing.border.EmptyBorder.getBorderInsets.

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

public Insets
getBorderInsets()

Overrides javax.swing.border.EmptyBorder.getBorderInsets.

Returns the insets of the border.

public Color

Returns:

the Color object used to render the border or null if a tile icon is used
getMatteColor
()

Returns the color used for tiling the border or null if a tile icon is being used.

public Icon

Returns:

the Icon used to tile the border or null if a solid color is used to fill the border
getTileIcon
()

Returns the icon used for tiling the border or null if a solid color is being used.

public boolean

Returns:

true if the border is opaque, false otherwise
isBorderOpaque
()

Overrides javax.swing.border.EmptyBorder.isBorderOpaque.

Implements javax.swing.border.Border.isBorderOpaque.

Returns whether or not the border is opaque.

public void
paintBorder(Component c, Graphics g, int x, int y, int width, int height)

Overrides javax.swing.border.EmptyBorder.paintBorder.

Implements javax.swing.border.Border.paintBorder.

Paints the matte border.

private void
paintEdge(Component c, Graphics g, int x, int y, int width, int height, int tileW, int tileH)

Field Detail

colorback to summary
protected Color color

The color rendered for the border.

tileIconback to summary
protected Icon tileIcon

The icon to be used for tiling the border.

Constructor Detail

MatteBorderback to summary
public MatteBorder(int top, int left, int bottom, int right, Color matteColor)

Creates a matte border with the specified insets and color.

Parameters
top:int

the top inset of the border

left:int

the left inset of the border

bottom:int

the bottom inset of the border

right:int

the right inset of the border

matteColor:Color

the color rendered for the border

MatteBorderback to summary
public MatteBorder(Insets borderInsets, Color matteColor)

Creates a matte border with the specified insets and color.

Parameters
borderInsets:Insets

the insets of the border

matteColor:Color

the color rendered for the border

Exceptions
NullPointerException:
if the specified borderInsets is null
Since
1.3
MatteBorderback to summary
public MatteBorder(int top, int left, int bottom, int right, Icon tileIcon)

Creates a matte border with the specified insets and tile icon.

Parameters
top:int

the top inset of the border

left:int

the left inset of the border

bottom:int

the bottom inset of the border

right:int

the right inset of the border

tileIcon:Icon

the icon to be used for tiling the border

MatteBorderback to summary
public MatteBorder(Insets borderInsets, Icon tileIcon)

Creates a matte border with the specified insets and tile icon.

Parameters
borderInsets:Insets

the insets of the border

tileIcon:Icon

the icon to be used for tiling the border

Exceptions
NullPointerException:
if the specified borderInsets is null
Since
1.3
MatteBorderback to summary
public MatteBorder(Icon tileIcon)

Creates a matte border with the specified tile icon. The insets will be calculated dynamically based on the size of the tile icon, where the top and bottom will be equal to the tile icon's height, and the left and right will be equal to the tile icon's width.

Parameters
tileIcon:Icon

the icon to be used for tiling the border

Method Detail

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

Overrides javax.swing.border.EmptyBorder.getBorderInsets.

Reinitialize 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

Exceptions
NullPointerException:
if the specified insets is null
Since
1.3
getBorderInsetsback to summary
public Insets getBorderInsets()

Overrides javax.swing.border.EmptyBorder.getBorderInsets.

Returns the insets of the border.

Since
1.3
getMatteColorback to summary
public Color getMatteColor()

Returns the color used for tiling the border or null if a tile icon is being used.

Returns:Color

the Color object used to render the border or null if a tile icon is used

Since
1.3
getTileIconback to summary
public Icon getTileIcon()

Returns the icon used for tiling the border or null if a solid color is being used.

Returns:Icon

the Icon used to tile the border or null if a solid color is used to fill the border

Since
1.3
isBorderOpaqueback to summary
public boolean isBorderOpaque()

Overrides javax.swing.border.EmptyBorder.isBorderOpaque.

Implements javax.swing.border.Border.isBorderOpaque.

Returns whether or not the border is opaque.

Returns:boolean

true if the border is opaque, false otherwise

paintBorderback to summary
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)

Overrides javax.swing.border.EmptyBorder.paintBorder.

Implements javax.swing.border.Border.paintBorder.

Paints the matte border.

paintEdgeback to summary
private void paintEdge(Component c, Graphics g, int x, int y, int width, int height, int tileW, int tileH)