Package com.jgoodies.common.internal
Class RenderingUtils
java.lang.Object
com.jgoodies.common.internal.RenderingUtils
Provides 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
FieldsModifier and TypeFieldDescriptionprivate static Method
Holds the public static methodSwingUtilities2#drawString
.private static Method
Holds the public static methodSwingUtilities2#drawStringUnderlinedAt
.private static Method
Holds the public static methodSwingUtilities2#getFontMetrics
.private static final String
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Map
static void
drawString
(JComponent c, Graphics g, String text, int x, int y) Draws the string at the specified location underlining the specified character.static void
drawStringUnderlineCharAt
(JComponent c, Graphics g, String text, int underlinedIndex, int x, int y) Draws the string at the specified location underlining the specified character.static FontMetrics
getFontMetrics
(JComponent c, Graphics g) Returns the FontMetrics for the current Font of the passed in Graphics.private static Method
private static Method
private static Method
private static Map
private static boolean
-
Field Details
-
PROP_DESKTOPHINTS
- See Also:
-
SWING_UTILITIES2_NAME
- See Also:
-
drawStringMethod
Holds the public static methodSwingUtilities2#drawString
. -
drawStringUnderlineCharAtMethod
Holds the public static methodSwingUtilities2#drawStringUnderlinedAt
. -
getFontMetricsMethod
Holds the public static methodSwingUtilities2#getFontMetrics
.
-
-
Constructor Details
-
RenderingUtils
private RenderingUtils()
-
-
Method Details
-
drawString
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(JComponent c, Graphics g, 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
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
-
getMethodDrawStringUnderlineCharAt
-
getMethodGetFontMetrics
-
installDesktopHints
-
desktopHints
-
isPrinting
-