edu.rice.cs.drjava.ui
Class ReverseHighlighter.DefaultFrameHighlightPainter

java.lang.Object
  extended by javax.swing.text.LayeredHighlighter.LayerPainter
      extended by edu.rice.cs.drjava.ui.ReverseHighlighter.DefaultFrameHighlightPainter
All Implemented Interfaces:
Highlighter.HighlightPainter
Enclosing class:
ReverseHighlighter

public static class ReverseHighlighter.DefaultFrameHighlightPainter
extends LayeredHighlighter.LayerPainter

Simple highlight painter that draws a rectangular box around text.


Field Summary
private  Color color
           
private  int thickness
           
 
Constructor Summary
ReverseHighlighter.DefaultFrameHighlightPainter(Color c, int t)
          Constructs a new highlight painter.
 
Method Summary
private  void drawRectThick(Graphics g, int x, int y, int width, int height, int thick)
           
 Color getColor()
           
 int getThickness()
           
 void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c)
          Paints a highlight.
 Shape paintLayer(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view)
          Paints a portion of a highlight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

private Color color

thickness

private int thickness
Constructor Detail

ReverseHighlighter.DefaultFrameHighlightPainter

public ReverseHighlighter.DefaultFrameHighlightPainter(Color c,
                                                       int t)
Constructs a new highlight painter. If c is null, the JTextComponent will be queried for its selection color.

Parameters:
c - the color for the highlight
t - the thickness in pixels
Method Detail

getColor

public Color getColor()
Returns:
the color of the highlight

getThickness

public int getThickness()
Returns:
thickness in pixels

drawRectThick

private void drawRectThick(Graphics g,
                           int x,
                           int y,
                           int width,
                           int height,
                           int thick)

paint

public void paint(Graphics g,
                  int offs0,
                  int offs1,
                  Shape bounds,
                  JTextComponent c)
Paints a highlight.

Parameters:
g - the graphics context
offs0 - the starting model offset >= 0
offs1 - the ending model offset >= offs1
bounds - the bounding box for the highlight
c - the editor

paintLayer

public Shape paintLayer(Graphics g,
                        int offs0,
                        int offs1,
                        Shape bounds,
                        JTextComponent c,
                        View view)
Paints a portion of a highlight.

Specified by:
paintLayer in class LayeredHighlighter.LayerPainter
Parameters:
g - the graphics context
offs0 - the starting model offset >= 0
offs1 - the ending model offset >= offs1
bounds - the bounding box of the view, which is not necessarily the region to paint.
c - the editor
view - View painting for
Returns:
region drawing occured in