swingx
Version 2005-08-19

org.jdesktop.swingx.painter
Class TextPainter

java.lang.Object
  extended by org.jdesktop.swingx.JavaBean
      extended by org.jdesktop.swingx.painter.AbstractPainter
          extended by org.jdesktop.swingx.painter.TextPainter
All Implemented Interfaces:
Painter

public class TextPainter
extends AbstractPainter

"Paints" text at the given location. The location should be a point where the x and y values are in the range of 0 to 1. Similar to the CSS background positioning algorithm, each value will be scaled along each axis of the component this TextPainter is painting, and then used to position the text. A value of 0,0 would put the text in the upper lefthand corner. 0.5,0.5 would position the text in the center and 1.0,1.0 would be at the lower righthand corner. For a more complete defintion of the positioning algorithm see the CSS 2.1 spec.


Constructor Summary
TextPainter()
          Creates a new instance of TextPainter
TextPainter(String text)
           
TextPainter(String text, Font font)
           
TextPainter(String text, Font font, Paint paint)
           
 
Method Summary
 Font getFont()
           
 Point2D getLocation()
           
 Paint getPaint()
           
 String getText()
           
protected  void paintBackground(Graphics2D g, JComponent component)
          Subclasses should implement this method and perform custom painting operations here.
 void setFont(Font f)
           
 void setLocation(Point2D location)
           
 void setPaint(Paint paint)
           
 void setText(String text)
           
 
Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter
getAlphaInterpolation, getAntialiasing, getClip, getColorRendering, getComposite, getDithering, getEffects, getFractionalMetrics, getInterpolation, getRendering, getRenderingHint, getRenderingHints, getResizeClip, getStrokeControl, getTextAntialiasing, isUseCache, paint, restoreState, saveState, setAlphaInterpolation, setAntialiasing, setClip, setColorRendering, setComposite, setDithering, setEffects, setEffects, setFractionalMetrics, setInterpolation, setRendering, setRenderingHint, setRenderingHints, setResizeClip, setStrokeControl, setTextAntialiasing, setUseCache
 
Methods inherited from class org.jdesktop.swingx.JavaBean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextPainter

public TextPainter()
Creates a new instance of TextPainter


TextPainter

public TextPainter(String text)

TextPainter

public TextPainter(String text,
                   Font font)

TextPainter

public TextPainter(String text,
                   Font font,
                   Paint paint)
Method Detail

setFont

public void setFont(Font f)

getFont

public Font getFont()

setText

public void setText(String text)

getText

public String getText()

setPaint

public void setPaint(Paint paint)

getPaint

public Paint getPaint()

setLocation

public void setLocation(Point2D location)

getLocation

public Point2D getLocation()

paintBackground

protected void paintBackground(Graphics2D g,
                               JComponent component)
Description copied from class: AbstractPainter
Subclasses should implement this method and perform custom painting operations here. Common behavior, such as setting the clip and composite, saving and restoring state, is performed in the "paint" method automatically, and then delegated here.

Specified by:
paintBackground in class AbstractPainter
Parameters:
g - The Graphics2D object in which to paint
component - The JComponent that the Painter is delegate for.

swingx
Version 2005-08-19