|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.synth.SynthGraphicsUtils
public class SynthGraphicsUtils
Wrapper for graphics primitives used in Synth.
Constructor Summary | |
---|---|
SynthGraphicsUtils()
Creates a new SynthGraphicsUtils object. |
Method Summary | |
---|---|
int |
computeStringWidth(SynthContext ctx,
Font font,
FontMetrics fm,
String text)
Returns the width of the string text for the specified font
and font metrics. |
void |
drawLine(SynthContext ctx,
Object paintKey,
Graphics g,
int x1,
int y1,
int x2,
int y2)
Draws a line from (x1,y1) to (x2,y2). |
int |
getMaximumCharHeight(SynthContext context)
Returns the maximum character height of the font from the component of the passed in context . |
Dimension |
getMaximumSize(SynthContext ctx,
Font font,
String text,
Icon icon,
int hAlign,
int vAlign,
int hTextPosition,
int vTextPosition,
int iconTextGap,
int mnemonicIndex)
Calculates the maximum size that is needed to render the label with text and icon correctly. |
Dimension |
getMinimumSize(SynthContext ctx,
Font font,
String text,
Icon icon,
int hAlign,
int vAlign,
int hTextPosition,
int vTextPosition,
int iconTextGap,
int mnemonicIndex)
Calculates the minimums size that is needed to render the label with text and icon correctly. |
Dimension |
getPreferredSize(SynthContext ctx,
Font font,
String text,
Icon icon,
int hAlign,
int vAlign,
int hTextPosition,
int vTextPosition,
int iconTextGap,
int mnemonicIndex)
Calculates the preferred size that is needed to render the label with text and icon correctly. |
String |
layoutText(SynthContext ctx,
FontMetrics fm,
String text,
Icon icon,
int hAlign,
int vAlign,
int hTextPos,
int vTextPos,
Rectangle viewR,
Rectangle iconR,
Rectangle textR,
int iconTextGap)
Lays out a label and (if non-null) an icon. |
void |
paintText(SynthContext ctx,
Graphics g,
String text,
Icon icon,
int hAlign,
int vAlign,
int hTextPosition,
int vTextPosition,
int iconTextGap,
int mnemonicIndex,
int textOffset)
|
void |
paintText(SynthContext ctx,
Graphics g,
String text,
int x,
int y,
int mnemonicIndex)
Renders the specified text at the specified location. |
void |
paintText(SynthContext ctx,
Graphics g,
String text,
Rectangle bounds,
int mnemonicIndex)
Renders the specified text within the bounds . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynthGraphicsUtils()
SynthGraphicsUtils
object.
Method Detail |
---|
public void drawLine(SynthContext ctx, Object paintKey, Graphics g, int x1, int y1, int x2, int y2)
ctx
- the synth context, identifies the regionpaintKey
- identifies the portion of the component to be painted, may
be null
g
- the graphics context to use for paintingx1
- the x coordinate of the start pointy1
- the y coordinate of the start pointx2
- the x coordinate of the end pointy2
- the y coordinate of the end pointpublic String layoutText(SynthContext ctx, FontMetrics fm, String text, Icon icon, int hAlign, int vAlign, int hTextPos, int vTextPos, Rectangle viewR, Rectangle iconR, Rectangle textR, int iconTextGap)
viewR
, iconR
and
textR
.
The alignment and position parameters may be one of the alignment or
position constants defined in SwingConstants
.
ctx
- the synth context, identifies the current regionfm
- the font metrics to use to fetch the text measurestext
- the text to lay out, may be null
icon
- the icon to lay out, may be null
hAlign
- the horizontal alignment of the labelvAlign
- the vertical alignment of the labelhTextPos
- the horizontal text positionvTextPos
- the vertical text positionviewR
- the view rectangle (return parameter)iconR
- the icon rectangle (return parameter)textR
- the text rectangle (return parameter)iconTextGap
- the gap between text and label
public int computeStringWidth(SynthContext ctx, Font font, FontMetrics fm, String text)
text
for the specified font
and font metrics.
ctx
- identifies the current regionfont
- the fontfm
- the font metrics to usetext
- the text to be measured
text
for the specified font
and font metricspublic Dimension getMinimumSize(SynthContext ctx, Font font, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex) throws NotImplementedException
text
and icon
correctly.
ctx
- identifies the current regionfont
- the font to usetext
- the label texticon
- the label iconhAlign
- the horizontal alignmentvAlign
- the vertical alignmenthTextPosition
- the horizontal text positionvTextPosition
- the vertical text positioniconTextGap
- the gap between icon and textmnemonicIndex
- index to the mnemonic character within
text
text
and icon
correctly
NotImplementedException
public Dimension getPreferredSize(SynthContext ctx, Font font, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex) throws NotImplementedException
text
and icon
correctly.
ctx
- identifies the current regionfont
- the font to usetext
- the label texticon
- the label iconhAlign
- the horizontal alignmentvAlign
- the vertical alignmenthTextPosition
- the horizontal text positionvTextPosition
- the vertical text positioniconTextGap
- the gap between icon and textmnemonicIndex
- index to the mnemonic character within
text
text
and icon
correctly
NotImplementedException
public Dimension getMaximumSize(SynthContext ctx, Font font, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex) throws NotImplementedException
text
and icon
correctly.
ctx
- identifies the current regionfont
- the font to usetext
- the label texticon
- the label iconhAlign
- the horizontal alignmentvAlign
- the vertical alignmenthTextPosition
- the horizontal text positionvTextPosition
- the vertical text positioniconTextGap
- the gap between icon and textmnemonicIndex
- index to the mnemonic character within
text
text
and icon
correctly
NotImplementedException
public int getMaximumCharHeight(SynthContext context)
context
.
context
- identifies the current component and region
context
public void paintText(SynthContext ctx, Graphics g, String text, Rectangle bounds, int mnemonicIndex)
text
within the bounds
.
ctx
- identifies the component and regiong
- the graphics context for drawing the tetxtext
- the text to be renderedbounds
- the bounds within which the text should be renderedmnemonicIndex
- the index of the mnemonic character within
text
public void paintText(SynthContext ctx, Graphics g, String text, int x, int y, int mnemonicIndex)
text
at the specified location.
ctx
- identifies the component and regiong
- the graphics context for drawing the tetxtext
- the text to be renderedx
- the X location where the text should be renderedy
- the Y location where the text should be renderedmnemonicIndex
- the index of the mnemonic character within
text
public void paintText(SynthContext ctx, Graphics g, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex, int textOffset) throws NotImplementedException
NotImplementedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |