public class

LineBorder

extends AbstractBorder
java.lang.Object
   ↳ javax.swing.border.AbstractBorder
     ↳ javax.swing.border.LineBorder
Known Direct Subclasses

Class Overview

A class which implements a line border of arbitrary thickness and of a single color.

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 XMLEncoder.

Summary

Fields
protected Color lineColor
protected boolean roundedCorners
protected int thickness
Public Constructors
LineBorder(Color color)
Creates a line border with the specified color and a thickness = 1.
LineBorder(Color color, int thickness)
Creates a line border with the specified color and thickness.
LineBorder(Color color, int thickness, boolean roundedCorners)
Creates a line border with the specified color, thickness, and corner shape.
Public Methods
static Border createBlackLineBorder()
Convenience method for getting the Color.black LineBorder of thickness 1.
static Border createGrayLineBorder()
Convenience method for getting the Color.gray LineBorder of thickness 1.
Insets getBorderInsets(Component c, Insets insets)
Reinitialize the insets parameter with this Border's current Insets.
Insets getBorderInsets(Component c)
Returns the insets of the border.
Color getLineColor()
Returns the color of the border.
boolean getRoundedCorners()
Returns whether this border will be drawn with rounded corners.
int getThickness()
Returns the thickness of the border.
boolean isBorderOpaque()
Returns whether or not the border is opaque.
void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
Paints the border for the specified component with the specified position and size.
[Expand]
Inherited Methods
From class javax.swing.border.AbstractBorder
From class java.lang.Object
From interface javax.swing.border.Border

Fields

protected Color lineColor

protected boolean roundedCorners

protected int thickness

Public Constructors

public LineBorder (Color color)

Creates a line border with the specified color and a thickness = 1.

Parameters
color the color for the border

public LineBorder (Color color, int thickness)

Creates a line border with the specified color and thickness.

Parameters
color the color of the border
thickness the thickness of the border

public LineBorder (Color color, int thickness, boolean roundedCorners)

Creates a line border with the specified color, thickness, and corner shape.

Parameters
color the color of the border
thickness the thickness of the border
roundedCorners whether or not border corners should be round

Public Methods

public static Border createBlackLineBorder ()

Convenience method for getting the Color.black LineBorder of thickness 1.

public static Border createGrayLineBorder ()

Convenience method for getting the Color.gray LineBorder of thickness 1.

public Insets getBorderInsets (Component c, Insets insets)

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

Parameters
c the component for which this border insets value applies
insets the object to be reinitialized
Returns
  • the insets object

public Insets getBorderInsets (Component c)

Returns the insets of the border.

Parameters
c the component for which this border insets value applies
Returns
  • the new Insets object initialized to 0

public Color getLineColor ()

Returns the color of the border.

public boolean getRoundedCorners ()

Returns whether this border will be drawn with rounded corners.

public int getThickness ()

Returns the thickness of the border.

public boolean isBorderOpaque ()

Returns whether or not the border is opaque.

Returns
  • false

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

Paints the border for the specified component with the specified position and size.

Parameters
c the component for which this border is being painted
g the paint graphics
x the x position of the painted border
y the y position of the painted border
width the width of the painted border
height the height of the painted border