All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.trumphurst.controls.StringPainter

java.lang.Object
   |
   +----com.trumphurst.controls.StringPainter

public class StringPainter
extends Object
implements ObjectPainter
ObjectPainter to paint a column of a MultiColumnList with the toString value of the object. Many other ObjectPainters are derived from this one, as it holds the column title, and it provides a useful utility function to paint a String, and some useful cached information about the current font.

See Also:
MultiColumnList, StringArrayPainter, TreePainter

Variable Index

 o fm
Cached FontMetrics.
 o textOffset
Cached offset of text base line in cell Rectangle.

Constructor Index

 o StringPainter(String)
Constructor.

Method Index

 o changeTitle(String)
Change the column heading.
 o paintObject(Graphics, Rectangle, Object, boolean)
Paints the String returned by o.toString().
 o paintString(Graphics, int, int, String)
Utility function to paint a String at a point.
 o paintTitle(Graphics, Rectangle, boolean)
Paints the title as the column heading.

Variables

 o fm
 protected FontMetrics fm
Cached FontMetrics. Updated each time the title is painted.

 o textOffset
 protected int textOffset
Cached offset of text base line in cell Rectangle. Updated each time the title is painted.

Constructors

 o StringPainter
 public StringPainter(String title)
Constructor.

Parameters:
title - The column heading.

Methods

 o changeTitle
 public void changeTitle(String title)
Change the column heading.

 o paintString
 protected void paintString(Graphics g,
                            int x,
                            int y,
                            String s)
Utility function to paint a String at a point.

Parameters:
g - The Graphics on which to paint.
x - The x position.
y - The y position of the top of the rectangle to contain the text.
s - The String to paint.
 o paintTitle
 public void paintTitle(Graphics g,
                        Rectangle r,
                        boolean clip)
Paints the title as the column heading.

 o paintObject
 public void paintObject(Graphics g,
                         Rectangle r,
                         Object o,
                         boolean clip)
Paints the String returned by o.toString().


All Packages  Class Hierarchy  This Package  Previous  Next  Index