public class DottedLinePainter extends SimpleLinePainter
DottedLinePainter
is an implementation of the
UnderlinePainter
which paints a straight,
but dotted underline or separator of a given thickness. Modifier and Type | Field and Description |
---|---|
protected int |
_dottedWidth
The width of the visible dotted line.
|
protected int |
_gapWidth
The width of the gap between the dotted lines.
|
static int |
MAX_WIDTH
The maximum width of either the visible dotted line (dottedWidth)
or the dotted gap.
|
static int |
MIN_WIDTH
The minimum width of either the visible dotted line (dottedWidth)
or the dotted gap.
|
_thickness, _underlineType, MAX_THICKNESS
TYPE_SEPARATOR, TYPE_STRIKETHRU, TYPE_UNDERLINE
Constructor and Description |
---|
DottedLinePainter(int thickness,
int underlineType,
int dottedWidth,
int gapWidth)
Constructs a new
DottedLinePainter of the specified
thickness. |
Modifier and Type | Method and Description |
---|---|
void |
paintUnderline(java.awt.Graphics graphics,
java.awt.Color color,
int xPos,
int width,
int yTop,
int yBaseline,
int descent)
Paints the underline using this implementation of the
UnderlinePainter . |
getUnderlineType, getYPos
public static final int MAX_WIDTH
public static final int MIN_WIDTH
protected final int _dottedWidth
protected final int _gapWidth
public DottedLinePainter(int thickness, int underlineType, int dottedWidth, int gapWidth)
DottedLinePainter
of the specified
thickness. The dottedWidth is the width of the visible (dotted)
lines, while the gapWidth is the width of the gaps between the
dotted lines.thickness
- the thickness of the line to paintunderlineType
- the type of underline, such as TYPE_SEPARATORdottedWidth
- the width of the visible linesgapWidth
- the width of the gap between visible linespublic void paintUnderline(java.awt.Graphics graphics, java.awt.Color color, int xPos, int width, int yTop, int yBaseline, int descent)
UnderlinePainter
.paintUnderline
in interface UnderlinePainter
paintUnderline
in class SimpleLinePainter
graphics
- the graphics context to paint intocolor
- the color to use for painting the underlinexPos
- the x position to start painting fromwidth
- the width of the underline to paintyTop
- the y position of the top of the textyBaseline
- the y position of the baseline of the text we are
drawing an underline fordescent
- the descent of the font the text was drawn with