public class PaletteUtilities
extends javax.swing.plaf.basic.BasicGraphicsUtils
Constructor and Description |
---|
PaletteUtilities() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
beginGraphics(java.awt.Graphics2D graphics2d) |
static void |
drawStringUnderlineCharAt(javax.swing.JComponent c,
java.awt.Graphics g,
java.lang.String text,
int underlinedIndex,
int x,
int y)
Draw a string with the graphics
g at location
(x , y )
just like g.drawString would. |
static void |
endGraphics(java.awt.Graphics2D graphics2d,
java.lang.Object oldHints) |
static java.awt.FontMetrics |
getFontMetrics(javax.swing.JComponent c,
java.awt.Graphics g)
Returns the FontMetrics for the current Font of the passed
in Graphics.
|
static java.awt.FontMetrics |
getFontMetrics(javax.swing.JComponent c,
java.awt.Graphics g,
java.awt.Font font)
Returns the FontMetrics for the specified Font.
|
public static final java.lang.Object beginGraphics(java.awt.Graphics2D graphics2d)
public static final void endGraphics(java.awt.Graphics2D graphics2d, java.lang.Object oldHints)
public static void drawStringUnderlineCharAt(javax.swing.JComponent c, java.awt.Graphics g, java.lang.String text, int underlinedIndex, int x, int y)
g
at location
(x
, y
)
just like g.drawString
would.
The character at index underlinedIndex
in text will be underlined. If index
is beyond the
bounds of text
(including < 0), nothing will be
underlined.g
- Graphics to draw withtext
- String to drawunderlinedIndex
- Index of character in text to underlinex
- x coordinate to draw aty
- y coordinate to draw atpublic static java.awt.FontMetrics getFontMetrics(javax.swing.JComponent c, java.awt.Graphics g)
Callers should pass in a non-null JComponent, the exception to this is if a JComponent is not readily available at the time of painting.
This does not necessarily return the FontMetrics from the Graphics.
c
- JComponent requesting FontMetrics, may be nullg
- Graphics Graphicspublic static java.awt.FontMetrics getFontMetrics(javax.swing.JComponent c, java.awt.Graphics g, java.awt.Font font)
Callers should pass in a non-null JComonent, the exception to this is if a JComponent is not readily available at the time of painting.
This does not necessarily return the FontMetrics from the Graphics.
c
- JComponent requesting FontMetrics, may be nullg
- Graphicsfont
- Font to get FontMetrics for