Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.javatools.editor.highlight
Class SimpleLinePainter

java.lang.Object
  extended by oracle.javatools.editor.highlight.SimpleLinePainter
All Implemented Interfaces:
UnderlinePainter
Direct Known Subclasses:
DottedLinePainter, ZigZagLinePainter

public class SimpleLinePainter
extends java.lang.Object
implements UnderlinePainter

The SimpleLinePainter is an implementation of the UnderlinePainter which paints a straight underline or separator of a given thickness.


Field Summary
protected  int _thickness
          The thickness of the line to paint.
protected  int _underlineType
          The type of underline, such as TYPE_UNDERLINE or TYPE_SEPARATOR.
static int MAX_THICKNESS
          The maximum thickness that can be specified to the line painter.
 
Fields inherited from interface oracle.javatools.editor.highlight.UnderlinePainter
TYPE_SEPARATOR, TYPE_STRIKETHRU, TYPE_UNDERLINE
 
Constructor Summary
SimpleLinePainter(int thickness, int underlineType)
          Constructs a new SimpleLinePainter of the specified thickness.
 
Method Summary
 int getUnderlineType()
          Fetch the type of underline, such as TYPE_SEPARATOR.
protected  int getYPos(int yTop, int yBaseline, int descent)
          Utility routine to calculate the appropriate y position to start painting downwards from, based on the requested paint position (from baseline or from bottom), and the yBaseline coordinate and the descent.)
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_THICKNESS

public static final int MAX_THICKNESS
The maximum thickness that can be specified to the line painter.

See Also:
Constant Field Values

_thickness

protected final int _thickness
The thickness of the line to paint.


_underlineType

protected final int _underlineType
The type of underline, such as TYPE_UNDERLINE or TYPE_SEPARATOR.

Constructor Detail

SimpleLinePainter

public SimpleLinePainter(int thickness,
                         int underlineType)
Constructs a new SimpleLinePainter of the specified thickness. Any thickness greater than MAX_THICKNESS will be automatically reduced. The type of underline indicates where the underline will be painted.

Parameters:
thickness - the thickness of the line to paint
underlineType - the type of underline, such as TYPE_SEPARATOR
Method Detail

getYPos

protected int getYPos(int yTop,
                      int yBaseline,
                      int descent)
Utility routine to calculate the appropriate y position to start painting downwards from, based on the requested paint position (from baseline or from bottom), and the yBaseline coordinate and the descent.)

Parameters:
yBaseline - the y position of the baseline
descent - the descent of the text below the baseline

paintUnderline

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

Specified by:
paintUnderline in interface UnderlinePainter
Parameters:
graphics - the graphics context to paint into
color - the color to use for painting the underline
xPos - the x position to start painting from
width - the width of the underline to paint
yTop - the y position of the top of the text
yBaseline - the y position of the baseline of the text we are drawing an underline for
descent - the descent of the font the text was drawn with

getUnderlineType

public int getUnderlineType()
Fetch the type of underline, such as TYPE_SEPARATOR.

Specified by:
getUnderlineType in interface UnderlinePainter
Returns:
the underline type

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.