ch.claudio.lib
Class DialogUtility

java.lang.Object
  extended by ch.claudio.lib.DialogUtility

public final class DialogUtility
extends java.lang.Object

Module containing methods useful in GUIs.

Version:
$Id: DialogUtility.java 226 2007-08-24 15:50:32Z claudio $
Author:
Claudio Nieder

Copyright (C) 2004-2007 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

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.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Field Summary
static java.awt.Insets defaultInsets
          Default Inset value to use in the constraints.
 
Method Summary
static void addExitOnClose(java.awt.Frame frame)
          Add a window listener which calls System.exit(1) when the user hits the close button of the window.
static void main(java.lang.String[] args)
          Print license.
static java.awt.Button newButton(java.lang.String label, java.awt.event.ActionListener listener)
          Create a Button with an action listener
static java.awt.GridBagConstraints newDefaultContraints()
          Create a default GridBagConstraints instance prefilled in a useful manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultInsets

public static final java.awt.Insets defaultInsets
Default Inset value to use in the constraints.

Method Detail

newDefaultContraints

public static final java.awt.GridBagConstraints newDefaultContraints()
Create a default GridBagConstraints instance prefilled in a useful manner.

Note: The weightx and weighty are prefilled with 1e-10. They are not filled with 1 as I assume most application have few areas which need to occupy large part of the gui. They are not filled with 0, as 0 is somehow special. If all weights are 0 then the components are not streched at all and extra space goes into the border around all components.

Returns:
instance

newButton

public static final java.awt.Button newButton(java.lang.String label,
                                              java.awt.event.ActionListener listener)
Create a Button with an action listener

Parameters:
label - Button label
listener - Action to perform
Returns:
button

addExitOnClose

public static final void addExitOnClose(java.awt.Frame frame)
Add a window listener which calls System.exit(1) when the user hits the close button of the window.

Parameters:
frame - to modify

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored