Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.swing
Class GuiUtil  view GuiUtil download GuiUtil.java

java.lang.Object
  extended bycom.eireneh.swing.GuiUtil

public class GuiUtil
extends java.lang.Object

Various Gui Utilities.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.


Constructor Summary
GuiUtil()
           
 
Method Summary
static void addAt(java.awt.Container pan, java.awt.Component com, int x, int y, int w, int h)
          To add a component at a specific place.
static void addConstrained(java.awt.Container pan, java.awt.Component com, java.awt.GridBagConstraints cons, int x, int y, int w, int h)
          Convenience for adding a set of components with similar layout constraints to a grid.
static void centerWindow(java.awt.Window win)
          Move the specified window to the centre of the screen
static void enforceMinimumSize(java.awt.Component comp, int min_width, int min_height)
          Set the size of a component
static java.awt.GridBagConstraints getConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, java.awt.Insets insets, int ipadx, int ipady)
          The full constructor for GridBagConstraints is not available at JDK 1.1, so this is a shortcut.
static java.awt.Frame getFrame(java.awt.Component com)
          Find the parent window
static java.lang.String getText(java.awt.Component comp)
          Attempts to get the text from a generic Component.
static java.awt.Window getWindow(java.awt.Component com)
          Find the parent window.
static javax.swing.ImageIcon loadImageIcon(java.lang.String name)
          Load an Icon using an absolute class name.
static void maximizeWindow(java.awt.Window win)
          Maximize the specified window.
static void restrainedPack(java.awt.Window win)
          Do a pack, but don't let the window grow or shrink by more than 10%
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiUtil

public GuiUtil()
Method Detail

loadImageIcon

public static javax.swing.ImageIcon loadImageIcon(java.lang.String name)
Load an Icon using an absolute class name. The normal method of using new ImageIcon(blah) is poor because is requires a relative URL


addConstrained

public static void addConstrained(java.awt.Container pan,
                                  java.awt.Component com,
                                  java.awt.GridBagConstraints cons,
                                  int x,
                                  int y,
                                  int w,
                                  int h)
Convenience for adding a set of components with similar layout constraints to a grid.


getConstraints

public static java.awt.GridBagConstraints getConstraints(int gridx,
                                                         int gridy,
                                                         int gridwidth,
                                                         int gridheight,
                                                         double weightx,
                                                         double weighty,
                                                         int anchor,
                                                         int fill,
                                                         java.awt.Insets insets,
                                                         int ipadx,
                                                         int ipady)
The full constructor for GridBagConstraints is not available at JDK 1.1, so this is a shortcut.


addAt

public static void addAt(java.awt.Container pan,
                         java.awt.Component com,
                         int x,
                         int y,
                         int w,
                         int h)
To add a component at a specific place.


getWindow

public static java.awt.Window getWindow(java.awt.Component com)
Find the parent window.


getFrame

public static java.awt.Frame getFrame(java.awt.Component com)
Find the parent window


centerWindow

public static void centerWindow(java.awt.Window win)
Move the specified window to the centre of the screen


maximizeWindow

public static void maximizeWindow(java.awt.Window win)
Maximize the specified window. It would be good if we could detect where the taskbar was and not obscure it ...


restrainedPack

public static void restrainedPack(java.awt.Window win)
Do a pack, but don't let the window grow or shrink by more than 10%


enforceMinimumSize

public static void enforceMinimumSize(java.awt.Component comp,
                                      int min_width,
                                      int min_height)
Set the size of a component


getText

public static java.lang.String getText(java.awt.Component comp)
Attempts to get the text from a generic Component. The Components that we can get some text from include:
  • JTextComponent
  • JLabel
  • AbstractButton
  • JComboBox
  • JToolTip
  • TextComponent
  • Button
  • Label
  • JScrollPane (recurse using the View) The others are done using toString()