java.lang.Object
javax.swing.border.AbstractBorder
javax.swing.border.LineBorder
- All Implemented Interfaces:
- Serializable,- Border
- Direct Known Subclasses:
- BorderUIResource.LineBorderUIResource
public class LineBorder extends AbstractBorder
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 JavaBeans™
 has been added to the java.beans package.
 Please see XMLEncoder.
- 
Field SummaryFields Modifier and Type Field Description protected ColorlineColorColor of the border.protected booleanroundedCornersWhether or not the border has rounded corners.protected intthicknessThickness of the border.
- 
Constructor SummaryConstructors Constructor Description 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.
- 
Method SummaryModifier and Type Method Description static BordercreateBlackLineBorder()Convenience method for getting the Color.black LineBorder of thickness 1.static BordercreateGrayLineBorder()Convenience method for getting the Color.gray LineBorder of thickness 1.InsetsgetBorderInsets(Component c, Insets insets)Reinitialize the insets parameter with this Border's current Insets.ColorgetLineColor()Returns the color of the border.booleangetRoundedCorners()Returns whether this border will be drawn with rounded corners.intgetThickness()Returns the thickness of the border.booleanisBorderOpaque()Returns whether or not the border is opaque.voidpaintBorder(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.Methods declared in class javax.swing.border.AbstractBordergetBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle
- 
Field Details- 
thicknessprotected int thicknessThickness of the border.
- 
lineColorColor of the border.
- 
roundedCornersprotected boolean roundedCornersWhether or not the border has rounded corners.
 
- 
- 
Constructor Details- 
LineBorderCreates a line border with the specified color and a thickness = 1.- Parameters:
- color- the color for the border
 
- 
LineBorderCreates a line border with the specified color and thickness.- Parameters:
- color- the color of the border
- thickness- the thickness of the border
 
- 
LineBorder@ConstructorProperties({"lineColor","thickness","roundedCorners"}) 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
- Since:
- 1.3
 
 
- 
- 
Method Details- 
createBlackLineBorderConvenience method for getting the Color.black LineBorder of thickness 1.- Returns:
- a LineBorderwithColor.blackand thickness of 1
 
- 
createGrayLineBorderConvenience method for getting the Color.gray LineBorder of thickness 1.- Returns:
- a LineBorderwithColor.grayand thickness of 1
 
- 
paintBorderPaints the border for the specified component with the specified position and size.- Specified by:
- paintBorderin interface- Border
- Overrides:
- paintBorderin class- AbstractBorder
- 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
 
- 
getBorderInsetsReinitialize the insets parameter with this Border's current Insets.- Overrides:
- getBorderInsetsin class- AbstractBorder
- Parameters:
- c- the component for which this border insets value applies
- insets- the object to be reinitialized
- Returns:
- the insetsobject
 
- 
getLineColorReturns the color of the border.- Returns:
- a Colorobject representing the color of this object
 
- 
getThicknesspublic int getThickness()Returns the thickness of the border.- Returns:
- the thickness of this border
 
- 
getRoundedCornerspublic boolean getRoundedCorners()Returns whether this border will be drawn with rounded corners.- Returns:
- trueif this border should have rounded corners
- Since:
- 1.3
 
- 
isBorderOpaquepublic boolean isBorderOpaque()Returns whether or not the border is opaque.- Specified by:
- isBorderOpaquein interface- Border
- Overrides:
- isBorderOpaquein class- AbstractBorder
- Returns:
- trueif the border is opaque,- falseotherwise
 
 
-