|
Oracle UIX API Reference Release 2.1.22.0.0 B12196-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.cabo.image.painter.AbstractPainter | +--oracle.cabo.image.painter.TextPainter
A painter capable of painting a string using the alignment of its PaintContext. If the string contains newlines, multiple lines of text will be painted.
This class uses new APIs in Java2 and propertly works with BufferedImages.
This TextPainter should be used for all String objects used in the ImageGenerator.
Fields inherited from interface oracle.cabo.image.painter.Painter |
STATE_ACTIVE_CHANGED, STATE_ARMED_CHANGED, STATE_BACKGROUND_CHANGED, STATE_ENABLED_CHANGED, STATE_FOCUSED_CHANGED, STATE_FONT_CHANGED, STATE_FOREGROUND_CHANGED, STATE_ISDEFAULT_CHANGED, STATE_MOUSE_OVER_CHANGED, STATE_READING_DIRECTION_CHANGED, STATE_SELECTED_CHANGED, STATE_SET_CHANGED, STATE_SIZE_CHANGED, STATE_XALIGNMENT_CHANGED, STATE_YALIGNMENT_CHANGED |
Constructor Summary | |
TextPainter()
Creates a TextPainter object, using the default label data key. |
|
TextPainter(java.lang.Object dataKey)
Creates a TextPainter object using the dataKey to get its
data and supporting mnemonics. |
|
TextPainter(java.lang.Object dataKey,
boolean supportMnemonics)
Creates a TextPainter object. |
Method Summary | |
protected java.lang.Object |
getData(PaintContext context)
|
protected java.lang.Object |
getDataKey()
|
int |
getInvalidateFlags(PaintContext context)
Returns the flags indicating the conditions under which the Painter must be invalidated. |
java.awt.Dimension |
getMinimumSize(PaintContext context)
Returns the minimum size of the painter. |
protected java.lang.String |
getMinimumStringData(PaintContext context)
Returns the String to use for the minimum size calculation. |
protected java.lang.String |
getPaintText(PaintContext context,
java.lang.String text,
java.awt.FontMetrics metrics,
int availableWidth)
This method is called for each line of text painted. |
java.awt.Dimension |
getPreferredSize(PaintContext context)
Returns the preferred size of the painter. |
int |
getRepaintFlags(PaintContext context)
Returns the flags indicating the conditions under which the Painter must be repainted. |
java.awt.Dimension |
getSize(PaintContext context,
int availableWidth,
int availableHeight)
Returns the size of the Painter for the specified amount of availableWidth and availableHeight. |
protected java.lang.String |
getStringData(PaintContext context)
Typesafe method to return the String to Paint. |
boolean |
isTransparent(PaintContext context)
Returns true if the Painter doesn't paint all of its pixels. |
void |
paint(PaintContext context,
java.awt.Graphics g,
int x,
int y,
int width,
int height)
Paints the TextPainter at the given location. |
protected int |
paintText(PaintContext context,
java.awt.Graphics g,
java.awt.FontMetrics metrics,
java.lang.String text,
int x,
int y,
int availableWidth,
float alignmentX,
int mnemonicIndex)
|
Methods inherited from class oracle.cabo.image.painter.AbstractPainter |
contains, getMaximumSize, getPainterAt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TextPainter()
public TextPainter(java.lang.Object dataKey)
dataKey
to get its
data and supporting mnemonics.
dataKey
- Key used by this TextPainter to retrieve the String
this TextPainter paints.
PaintContext.getPaintData(java.lang.Object)
public TextPainter(java.lang.Object dataKey, boolean supportMnemonics)
dataKey
- Key used by this TextPainter to retrieve the
String this TextPainter paints.supportMnemonics
- True if this TextPainter should ask its
Paint context for a mnemonic to paint.
PaintContext.getPaintData(java.lang.Object)
Method Detail |
public java.awt.Dimension getSize(PaintContext context, int availableWidth, int availableHeight)
getSize
in class AbstractPainter
context
- Context for deterimining the size.availableWidth
- Amount of width available to the Painter.availableHeight
- Amount of height available to the Painter.
public java.awt.Dimension getPreferredSize(PaintContext context)
getPreferredSize
in class AbstractPainter
context
- Context for determining the preferred size.public java.awt.Dimension getMinimumSize(PaintContext context)
context
- Context for determining the minimum size.public void paint(PaintContext context, java.awt.Graphics g, int x, int y, int width, int height)
context
- Context for painting.g
- Graphics object to draw into.x
- X position to draw at.y
- Y position to draw at.width
- Width to draw into.height
- Height to draw into.public boolean isTransparent(PaintContext context)
isTransparent
in class AbstractPainter
context
- Context for determining transparency.
public int getRepaintFlags(PaintContext context)
getRepaintFlags
in class AbstractPainter
context
- Context to use for determining the conditions under
which repainting is required.
public int getInvalidateFlags(PaintContext context)
getInvalidateFlags
in class AbstractPainter
context
- Context to use for determining the conditions under
which invalidation is required.
protected java.lang.String getPaintText(PaintContext context, java.lang.String text, java.awt.FontMetrics metrics, int availableWidth)
context
- Context for determining the text to paint.text
- Text data for this line.metrics
- FontMetrics to use to paint the text.availableWidth
- Number of pixels available to paint the text.
protected java.lang.String getStringData(PaintContext context)
getData()
, as overriding getStringData()
directly is more efficient.
context
- PaintContext to use to retrieve the TextPainter's
String data.
getData(oracle.cabo.image.painter.PaintContext)
protected java.lang.String getMinimumStringData(PaintContext context)
protected java.lang.Object getData(PaintContext context)
getData
in class AbstractPainter
protected java.lang.Object getDataKey()
getDataKey
in class AbstractPainter
protected int paintText(PaintContext context, java.awt.Graphics g, java.awt.FontMetrics metrics, java.lang.String text, int x, int y, int availableWidth, float alignmentX, int mnemonicIndex)
|
Oracle UIX API Reference Release 2.1.22.0.0 B12196-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |