Class symantec.itools.awt.util.Util
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class symantec.itools.awt.util.Util
Object
   |
   +----symantec.itools.awt.util.Util
  -  public class Util
  
-  extends Object
  
An all-static utility class with handy helper methods to retrieve font information.
  
  -  
	symantec.itools.awt.util.Util()
   -   Do not use, all-static class.
 
  
  -  
	findComponent(Container, Component)
   -   Finds the index of a component in a container.
  
 -  
	getDefaultFont()
   -   Retrieves a default dialog font.
  
 -  
	getFontHeight(Graphics)
   -   Determines the height of the font being used by the given
 graphics context.
  
 -  
	getFontHeight(Font)
   -   Determines the height of the font specified.
  
 -  
	getFontHeight(FontMetrics)
   -   Determines the height of the font given the metrics of that font.
  
 -  
	getGraphics(Image, Component)
   -   Preserves the font information of a graphics object retrieved from
 an image.
  
 -  
	getStringWidth(Graphics, String)
   -   Determines the width of the given string if it were drawn using the
 specified graphics context.
  
 -  
	getStringWidth(Font, String)
   -   Determines the width of the given string if it were drawn using the
 specified font.
  
 -  
	getStringWidth(FontMetrics, String)
   -   Determines the width of the given string if it were drawn in a font
 with the specified metrics.
 
  
Util
public Util()
  -  Do not use, all-static class.
  
 
 
  
findComponent
public static int findComponent(Container container,
                                Component component)
  -  Finds the index of a component in a container.
  
 
 
    -  Parameters:
    
 -  container - the container to search
    
-  component - the component to find
    
  -  Returns:
    
 -  the zero-relative component index, or -1 if the component is not
 found in the container
  
 
 
 
getDefaultFont
public static java.awt.Font getDefaultFont()
  -  Retrieves a default dialog font.
 In this case the typeface is a plain 12-point “Dialog”.
  
 
 
    -  Returns:
    
 -  the default dialog font
  
 
 
 
getFontHeight
public static int getFontHeight(Graphics g)
  -  Determines the height of the font being used by the given
 graphics context.
 This is the standard height of a line of text in the font.
  
 
 
    -  Parameters:
    
 -  g - a graphics context
    
 -  Returns:
    
 -  the font height, in pixels
  
 
 
 
getFontHeight
public static int getFontHeight(Font f)
  -  Determines the height of the font specified.
 This is the standard height of a line of text in the font.
  
 
 
    -  Parameters:
    
 -  f - the font
    
 -  Returns:
    
 -  the font height, in pixels
  
 
 
 
getFontHeight
public static int getFontHeight(FontMetrics m)
  -  Determines the height of the font given the metrics of that font.
 This is the standard height of a line of text in the font.
  
 
 
    -  Parameters:
    
 -  m - the metrics of the font
    
 -  Returns:
    
 -  the font height, in pixels
  
 
 
 
getGraphics
public static java.awt.Graphics getGraphics(Image image,
                                            Component component)
  -  Preserves the font information of a graphics object retrieved from
 an image. This ensures that susequent calls to getFontMetrics through
 the graphics object will not result in a NullPointerException.
 It does this by setting the font in the image’s graphics context to
 the font in the component, as needed.
  
 
 
    -  Parameters:
    
 -  image - the image with the desired graphics context
    
-  component - the component
    
  -  Returns:
    
 -  a graphics context with a currently set font
  
 
 
 
getStringWidth
public static int getStringWidth(Graphics g,
                                 String s)
  -  Determines the width of the given string if it were drawn using the
 specified graphics context.
  
 
 
    -  Parameters:
    
 -  g - the graphics context
    
-  s - the string to determine the width of
    
  -  Returns:
    
 -  the width of the string, in pixels
  
 
 
 
getStringWidth
public static int getStringWidth(Font f,
                                 String s)
  -  Determines the width of the given string if it were drawn using the
 specified font.
  
 
 
    -  Parameters:
    
 -  g - the font
    
-  s - the string to determine the width of
    
  -  Returns:
    
 -  the width of the string, in pixels
  
 
 
 
getStringWidth
public static int getStringWidth(FontMetrics m,
                                 String s)
  -  Determines the width of the given string if it were drawn in a font
 with the specified metrics.
  
 
 
    -  Parameters:
    
 -  m - the font metrics
    
-  s - the string to determine the width of
    
  -  Returns:
    
 -  the width of the string, in pixels
  
 
 
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index