de.hunsicker.swing.util
Class SwingHelper

java.lang.Object
  |
  +--de.hunsicker.swing.util.SwingHelper

public final class SwingHelper
extends java.lang.Object

UI related helper functions.

Version:
$Revision: 1.2 $
Author:
Marco Hunsicker

Method Summary
static javax.swing.JButton createButton(java.lang.String text)
          Creates a new button with the given text.
static javax.swing.JButton createButton(java.lang.String text, boolean parse)
          Creates a new button with the given text.
static java.awt.Frame getOwnerFrame(java.awt.Component component)
          Returns the frame that contains the given component.
static int getTableHeight(javax.swing.JTable table)
          Returns the visual height of the given table.
static java.awt.GridBagConstraints setConstraints(java.awt.GridBagConstraints constraints, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, java.awt.Insets insets, int ipadx, int ipady)
          Sets the constraints for the given constraints object.
static void setMenuText(javax.swing.AbstractButton item, java.lang.String text, boolean useMnemonic)
          DOCUMENT ME!
static int showJFileChooser(javax.swing.JFileChooser chooser, java.awt.Component parent, java.lang.String approveButtonText)
          Displays the given file chooser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setConstraints

public static java.awt.GridBagConstraints setConstraints(java.awt.GridBagConstraints constraints,
                                                         int gridx,
                                                         int gridy,
                                                         int gridwidth,
                                                         int gridheight,
                                                         double weightx,
                                                         double weighty,
                                                         int anchor,
                                                         int fill,
                                                         java.awt.Insets insets,
                                                         int ipadx,
                                                         int ipady)
Sets the constraints for the given constraints object. Helper function to be able to reuse a constraints object.

Parameters:
constraints - the constraints object to initialize.
gridx - the initial gridx value.
gridy - the initial gridy value.
gridwidth - the initial gridwidth value.
gridheight - the initial gridheight value.
weightx - the initial weightx value.
weighty - the initial weighty value.
anchor - the initial anchor value.
fill - the initial fill value.
insets - the initial insets value.
ipadx - the initial ipadx value.
ipady - the initial ipady value.
Returns:
the initialized constraints object.

setMenuText

public static void setMenuText(javax.swing.AbstractButton item,
                               java.lang.String text,
                               boolean useMnemonic)
DOCUMENT ME!

Parameters:
item - DOCUMENT ME!
text - DOCUMENT ME!
useMnemonic - DOCUMENT ME!

getOwnerFrame

public static java.awt.Frame getOwnerFrame(java.awt.Component component)
Returns the frame that contains the given component.

Parameters:
component - component.
Returns:
frame that contains the given component or null if there is no parent frame.

getTableHeight

public static int getTableHeight(javax.swing.JTable table)
Returns the visual height of the given table.

Parameters:
table - the table.
Returns:
the table height.

createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               boolean parse)
Creates a new button with the given text.

Parameters:
text - DOCUMENT ME!
parse - DOCUMENT ME!
Returns:
new button with the given text.
Since:
1.0b9

createButton

public static javax.swing.JButton createButton(java.lang.String text)
Creates a new button with the given text.

Parameters:
text - DOCUMENT ME!
Returns:
new button with the given text.
Since:
1.0b9

showJFileChooser

public static final int showJFileChooser(javax.swing.JFileChooser chooser,
                                         java.awt.Component parent,
                                         java.lang.String approveButtonText)
Displays the given file chooser. Utility method for avoiding of memory leak in JDK 1.3 JFileChooser.showDialog(java.awt.Component, java.lang.String).

Parameters:
chooser - the file chooser to display.
parent - the parent window.
approveButtonText - the text for the approve button.
Returns:
the return code of the chooser.


Copyright © 1997-2005 Jalopy. All Rights Reserved.