public class LineBorder extends AbstractBorder
tempRect
Constructor and Description |
---|
LineBorder()
Constructs a default black LineBorder with a width of one pixel.
|
LineBorder(Color color)
Constructs a LineBorder with the specified color and a width of 1 pixel.
|
LineBorder(Color color,
int width)
Constructs a LineBorder with the specified color and of the specified
width.
|
LineBorder(Color color,
int width,
int style)
Constructs a LineBorder with the specified color and of the specified
width and style.
|
LineBorder(int width)
Constructs a black LineBorder with the specified width.
|
Modifier and Type | Method and Description |
---|---|
Color |
getColor()
Returns the line color of this border.
|
Insets |
getInsets(IFigure figure)
Returns the space used by the border for the figure provided as input.
|
int |
getStyle()
Returns the line style for this border.
|
int |
getWidth()
Returns the line width of this border.
|
boolean |
isOpaque()
Returns
true since this border is opaque. |
void |
paint(IFigure figure,
Graphics graphics,
Insets insets)
Paints the border.
|
void |
setColor(Color color)
Sets the line color for this border.
|
void |
setStyle(int style)
Sets the line type of this border.
|
void |
setWidth(int width)
Sets the line width for this border.
|
getPaintRectangle, getPreferredSize
public LineBorder(Color color, int width, int style)
color
- The color of the border.width
- The width of the border in pixels.style
- The style of the border. For the list of valid values, see
Graphics
public LineBorder(Color color, int width)
color
- The color of the border.width
- The width of the border in pixels.public LineBorder(Color color)
color
- The color of the border.public LineBorder(int width)
width
- The width of the border in pixels.public LineBorder()
public Color getColor()
public Insets getInsets(IFigure figure)
figure
- The figure this border belongs topublic int getWidth()
public boolean isOpaque()
true
since this border is opaque. Being opaque it is
responsible to fill in the area within its boundaries.isOpaque
in interface Border
isOpaque
in class AbstractBorder
true
since this border is opaqueBorder.isOpaque()
public void paint(IFigure figure, Graphics graphics, Insets insets)
Border
IFigure.getBounds()
, inset by the parameter insets. The
border generally should not paint inside its own insets. More
specifically, Border b should paint inside the rectangle:
figure.getBounds().getCropped(insets) and outside of the rectangle:
figure.getBounds().getCropped(insets).getCropped(getInsets()) where
inside is defined as Rectangle.contains(int, int)
.figure
- The figure this border belongs tographics
- The graphics object used for paintinginsets
- The insetsBorder.paint(IFigure, Graphics, Insets)
public void setColor(Color color)
color
- The line colorpublic void setWidth(int width)
width
- The line widthpublic int getStyle()
public void setStyle(int style)
style
- For the list of valid values, see
Graphics
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.