|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SubstanceTextPainter
Base interface for Substance text painters.
| Nested Class Summary | |
|---|---|
static interface |
SubstanceTextPainter.BackgroundPaintingCallback
Callback for custom background painting. |
static class |
SubstanceTextPainter.ImageBackgroundPaintingCallback
Background painting callback that draws an image at the specified location. |
| Method Summary | |
|---|---|
void |
attachCallback(SubstanceTextPainter.BackgroundPaintingCallback backgroundPaintingCallback)
Attaches the specified background painting callback. |
void |
attachText(javax.swing.JComponent comp,
java.awt.Rectangle textRect,
java.lang.String text,
int mnemonicIndex,
java.awt.Font font,
java.awt.Color color,
java.awt.Rectangle clip)
Attaches the specified text to paint. |
void |
attachVerticalText(javax.swing.JComponent comp,
java.awt.Rectangle textRect,
java.lang.String text,
int mnemonicIndex,
java.awt.Font font,
java.awt.Color color,
java.awt.Rectangle clip,
boolean isFromBottomToTop)
Attaches the specified vertical text to paint. |
void |
dispose()
Disposes the resources allocated by this text painter. |
java.awt.Dimension |
getTextBounds(java.awt.Component comp,
java.awt.Font font,
java.lang.String text)
|
void |
init(javax.swing.JComponent comp,
java.awt.Rectangle clip,
boolean toEnforceRenderOnNoTexts)
Re-initializes the contents of this painter. |
boolean |
isNative()
Returns true if this text painter uses native font
rendering. |
boolean |
needsBackgroundImage()
Returns indication whether this painter requires background to be fully set before painting the text (with renderSurface(Graphics)). |
void |
renderSurface(java.awt.Graphics g)
Paints the surface. |
void |
setBackgroundFill(javax.swing.JComponent comp,
java.awt.Color backgroundFillColor,
boolean toOverlayWatermark,
int watermarkOffsetX,
int watermarkOffsetY)
Sets the fill color of the background. |
| Method Detail |
|---|
void init(javax.swing.JComponent comp,
java.awt.Rectangle clip,
boolean toEnforceRenderOnNoTexts)
comp - Component.clip - Clip to apply. The painter implementation should respect this
clip, especially on components such as lists or tables that
use cell renderers. In these components, the specific cell is
usually much smaller than the whole component, and the
painting is done on each visible cell in a loop.toEnforceRenderOnNoTexts - If true, the painter implementation must
fill the background and invoke all callbacks even when there
are no attached texts or all texts are empty.AbstractTextPainterboolean needsBackgroundImage()
renderSurface(Graphics)).
true if this painter requires background to be
fully set before painting the text, false
otherwise.
void setBackgroundFill(javax.swing.JComponent comp,
java.awt.Color backgroundFillColor,
boolean toOverlayWatermark,
int watermarkOffsetX,
int watermarkOffsetY)
comp - Component.backgroundFillColor - Fill color for the background.toOverlayWatermark - If true, the background fill should be
overlayed with the current watermark.watermarkOffsetX - The X offset for the watermark relative to the screen position
of the component. This is relevant for cell-based components
such as lists, tables and trees.watermarkOffsetY - The Y offset for the watermark relative to the screen position
of the component. This is relevant for cell-based components
such as lists, tables and trees.void attachCallback(SubstanceTextPainter.BackgroundPaintingCallback backgroundPaintingCallback)
backgroundPaintingCallback - Background painting callback to attach.
void attachText(javax.swing.JComponent comp,
java.awt.Rectangle textRect,
java.lang.String text,
int mnemonicIndex,
java.awt.Font font,
java.awt.Color color,
java.awt.Rectangle clip)
comp - Component.textRect - Text rectangle.text - The text itself.mnemonicIndex - Optional mnemonic index. Can be -1 if no mnemonic.font - Font for this text.color - Color for this text.clip - Clip rectangle for this text.
void attachVerticalText(javax.swing.JComponent comp,
java.awt.Rectangle textRect,
java.lang.String text,
int mnemonicIndex,
java.awt.Font font,
java.awt.Color color,
java.awt.Rectangle clip,
boolean isFromBottomToTop)
comp - Component.textRect - Text rectangle.text - The text itself.mnemonicIndex - Optional mnemonic index. Can be -1 if no mnemonic.font - Font for this text.color - Color for this text.clip - Clip rectangle for this text.isFromBottomToTop - If true, the text will be painted from bottom
to top (so that the top of the letters is on the left). If
false, the text will be painted from top to
bottom (so that the top of the letters is on the right).void renderSurface(java.awt.Graphics g)
#init(JComponent, Rectangle), background fill set in
setBackgroundFill(JComponent, Color, boolean, int, int), invoke
the background callbacks added with
attachCallback(BackgroundPaintingCallback) and paint all the
texts added with
#attachText(JComponent, Rectangle, String, int, Font, Color).
g - Graphic context.boolean isNative()
true if this text painter uses native font
rendering.
true if this text painter uses native font
rendering.void dispose()
java.awt.Dimension getTextBounds(java.awt.Component comp,
java.awt.Font font,
java.lang.String text)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||