cds.gui
Class GuiUtils

java.lang.Object
  extended bycds.gui.GuiUtils

public class GuiUtils
extends java.lang.Object

Class containing static utility functions usefull in developping Graphical User Interfaces

Version:
1.0 July 2003
Author:
Marc Wenger/CDS

Constructor Summary
GuiUtils()
           
 
Method Summary
static java.awt.Rectangle absBounds(java.awt.Component c)
          Computes the absolute rectangle bounding a Component.
static void centerWindow(java.awt.Window win)
          Center a Frame on the screen
static void centerWindow(java.awt.Window win, int offX, int offY)
          Center a Frame on the screen with an offset
static java.awt.Dimension stringDimension(java.lang.String str, java.awt.Component c)
          Computes the size of a string for a given Component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiUtils

public GuiUtils()
Method Detail

stringDimension

public static java.awt.Dimension stringDimension(java.lang.String str,
                                                 java.awt.Component c)
Computes the size of a string for a given Component

Parameters:
str - string to use for the calculation
c - Component for which the size of the String will be computed
Returns:
the Dimension (widht, height) in pixels of the String

absBounds

public static java.awt.Rectangle absBounds(java.awt.Component c)
Computes the absolute rectangle bounding a Component.

Parameters:
c - component
Returns:
the rectangle position and size on the screen

centerWindow

public static void centerWindow(java.awt.Window win,
                                int offX,
                                int offY)
Center a Frame on the screen with an offset

Parameters:
offX - horizontal offset. a positive value leads to a right offset
offY - vertical offset. a positive value leads to a down offset

centerWindow

public static void centerWindow(java.awt.Window win)
Center a Frame on the screen