Package com.jgoodies.common.internal
Class RenderingUtils
- java.lang.Object
-
- com.jgoodies.common.internal.RenderingUtils
-
public final class RenderingUtils extends java.lang.ObjectProvides convenience behavior for drawing strings, underline chars, and accessing font metrics.Note: This class is not part of the public JGoodies Common API. It should be treated as library internal and should not be used by API users. It may be removed or changed without further notice.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.reflect.MethoddrawStringMethodHolds the public static methodSwingUtilities2#drawString.private static java.lang.reflect.MethoddrawStringUnderlineCharAtMethodHolds the public static methodSwingUtilities2#drawStringUnderlinedAt.private static java.lang.reflect.MethodgetFontMetricsMethodHolds the public static methodSwingUtilities2#getFontMetrics.private static java.lang.StringPROP_DESKTOPHINTSprivate static java.lang.StringSWING_UTILITIES2_NAME
-
Constructor Summary
Constructors Modifier Constructor Description privateRenderingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.MapdesktopHints(java.awt.Graphics2D g2)static voiddrawString(javax.swing.JComponent c, java.awt.Graphics g, java.lang.String text, int x, int y)Draws the string at the specified location underlining the specified character.static voiddrawStringUnderlineCharAt(javax.swing.JComponent c, java.awt.Graphics g, java.lang.String text, int underlinedIndex, int x, int y)Draws the string at the specified location underlining the specified character.static java.awt.FontMetricsgetFontMetrics(javax.swing.JComponent c, java.awt.Graphics g)Returns the FontMetrics for the current Font of the passed in Graphics.private static java.lang.reflect.MethodgetMethodDrawString()private static java.lang.reflect.MethodgetMethodDrawStringUnderlineCharAt()private static java.lang.reflect.MethodgetMethodGetFontMetrics()private static java.util.MapinstallDesktopHints(java.awt.Graphics2D g2)private static booleanisPrinting(java.awt.Graphics g)
-
-
-
Field Detail
-
PROP_DESKTOPHINTS
private static final java.lang.String PROP_DESKTOPHINTS
- See Also:
- Constant Field Values
-
SWING_UTILITIES2_NAME
private static final java.lang.String SWING_UTILITIES2_NAME
- See Also:
- Constant Field Values
-
drawStringMethod
private static java.lang.reflect.Method drawStringMethod
Holds the public static methodSwingUtilities2#drawString.
-
drawStringUnderlineCharAtMethod
private static java.lang.reflect.Method drawStringUnderlineCharAtMethod
Holds the public static methodSwingUtilities2#drawStringUnderlinedAt.
-
getFontMetricsMethod
private static java.lang.reflect.Method getFontMetricsMethod
Holds the public static methodSwingUtilities2#getFontMetrics.
-
-
Method Detail
-
drawString
public static void drawString(javax.swing.JComponent c, java.awt.Graphics g, java.lang.String text, int x, int y)Draws the string at the specified location underlining the specified character.- Parameters:
c- JComponent that will display the string, may be nullg- Graphics to draw the text totext- String to displayx- X coordinate to draw the text aty- Y coordinate to draw the text at
-
drawStringUnderlineCharAt
public static void drawStringUnderlineCharAt(javax.swing.JComponent c, java.awt.Graphics g, java.lang.String text, int underlinedIndex, int x, int y)Draws the string at the specified location underlining the specified character.- Parameters:
c- JComponent that will display the string, may be nullg- Graphics to draw the text totext- String to displayunderlinedIndex- Index of a character in the string to underlinex- X coordinate to draw the text aty- Y coordinate to draw the text at
-
getFontMetrics
public 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. This method is used when a Graphics is available, typically when painting. If a Graphics is not available the JComponent method of the same name should be used.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.
- Parameters:
c- JComponent requesting FontMetrics, may be nullg- Graphics Graphics- Returns:
- the FontMetrics
-
getMethodDrawString
private static java.lang.reflect.Method getMethodDrawString()
-
getMethodDrawStringUnderlineCharAt
private static java.lang.reflect.Method getMethodDrawStringUnderlineCharAt()
-
getMethodGetFontMetrics
private static java.lang.reflect.Method getMethodGetFontMetrics()
-
installDesktopHints
private static java.util.Map installDesktopHints(java.awt.Graphics2D g2)
-
desktopHints
private static java.util.Map desktopHints(java.awt.Graphics2D g2)
-
isPrinting
private static boolean isPrinting(java.awt.Graphics g)
-
-