public class TextPainter extends AbstractAreaPainter<Object>
AbstractAreaPainter.Style
AbstractLayoutPainter.HorizontalAlignment, AbstractLayoutPainter.VerticalAlignment
AbstractPainter.Interpolation
Constructor and Description |
---|
TextPainter()
Creates a new instance of TextPainter
|
TextPainter(String text)
Create a new TextPainter which will paint the specified text
|
TextPainter(String text,
Font font)
Create a new TextPainter which will paint the specified text with the specified font.
|
TextPainter(String text,
Font font,
Paint paint)
Create a new TextPainter which will paint the specified text with the specified font and paint.
|
TextPainter(String text,
Paint paint)
Create a new TextPainter which will paint the specified text with the specified paint.
|
Modifier and Type | Method and Description |
---|---|
private Font |
calculateFont(Object component) |
private String |
calculateText(Object component) |
protected void |
doPaint(Graphics2D g,
Object component,
int width,
int height)
Subclasses must implement this method and perform custom painting operations
here.
|
Font |
getFont()
gets the font (and font size and style) to be used when drawing the text
|
String |
getText()
gets the text currently used to draw
|
protected Shape |
provideShape(Graphics2D g2,
Object comp,
int width,
int height)
Returns the outline shape of this painter.
|
void |
setFont(Font f)
Set the font (and font size and style) to be used when drawing the text
|
void |
setText(String text)
Sets the text to draw
|
calculateSnappedPaint, getAreaEffects, getBorderPaint, getBorderWidth, getFillPaint, getStyle, isPaintStretched, setAreaEffects, setBorderPaint, setBorderWidth, setFillPaint, setPaintStretched, setStyle
calculateLayout, getHorizontalAlignment, getInsets, getVerticalAlignment, isFillHorizontal, isFillVertical, setFillHorizontal, setFillVertical, setHorizontalAlignment, setInsets, setVerticalAlignment
clearCache, configureGraphics, getFilters, getInterpolation, isAntialiasing, isCacheable, isCacheCleared, isDirty, isInPaintContext, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInPaintContext, setInterpolation, setVisible, shouldUseCache, validate
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
public TextPainter()
public TextPainter(String text)
text
- the text to paintpublic TextPainter(String text, Font font)
text
- the text to paintfont
- the font to paint the text withpublic TextPainter(String text, Paint paint)
text
- the text to paintpaint
- the paint to paint withpublic TextPainter(String text, Font font, Paint paint)
text
- the text to paintfont
- the font to paint the text withpaint
- the paint to paint withpublic void setFont(Font f)
f
- the new fontpublic Font getFont()
protected void doPaint(Graphics2D g, Object component, int width, int height)
doPaint
in class AbstractPainter<Object>
g
- The Graphics2D object in which to paintprivate String calculateText(Object component)
private Font calculateFont(Object component)
protected Shape provideShape(Graphics2D g2, Object comp, int width, int height)
provideShape
in class AbstractAreaPainter<Object>
g2
- graphicscomp
- The Object this painter will be painted on.width
- the width to paintheight
- the height to paintWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses