com.jgoodies.common.internal
Class RenderingUtils

java.lang.Object
  extended by com.jgoodies.common.internal.RenderingUtils

public final class RenderingUtils
extends Object

Provides convenience behavior for drawing strings, underline chars and accessing font metrics.

Note: This class is not part of the publi JGoodies Common API It should be treated as library internal and should not be used b API users. It may be removed or changed without further notice.

Version:
$Revision: 1.6 $
Author:
Karsten Lentzsch

Method Summary
static void drawString(JComponent c, Graphics g, String text, int x, int y)
          Draws the string at the specified location underlining the specifie 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 specifie character.
static FontMetrics getFontMetrics(JComponent c, Graphics g)
          Returns the FontMetrics for the current Font of the passe in Graphics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

drawString

public static void drawString(JComponent c,
                              Graphics g,
                              String text,
                              int x,
                              int y)
Draws the string at the specified location underlining the specifie character.

Parameters:
c - JComponent that will display the string, may be null
g - Graphics to draw the text to
text - String to display
x - X coordinate to draw the text at
y - 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 specifie character.

Parameters:
c - JComponent that will display the string, may be null
g - Graphics to draw the text to
text - String to display
underlinedIndex - Index of a character in the string to underline
x - X coordinate to draw the text at
y - Y coordinate to draw the text at

getFontMetrics

public static FontMetrics getFontMetrics(JComponent c,
                                         Graphics g)
Returns the FontMetrics for the current Font of the passe in Graphics. This method is used when a Graphic is available, typically when painting. If a Graphics is no available the JComponent method of the same name should be used

Parameters:
c - JComponent requesting FontMetrics, may be null
g - Graphics Graphics
Returns:
the FontMetrics


Copyright © 2009-2013 JGoodies Software GmbH. All Rights Reserved.