com.gridsystems.config.tools.swing
Class SwingTools

java.lang.Object
  extended by com.gridsystems.config.tools.swing.SwingTools

public final class SwingTools
extends java.lang.Object

Helper methods for Swing UI construction.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo

Method Summary
static void addField(javax.swing.JPanel panel, java.lang.String label, javax.swing.JComponent c, int row)
          Adds a row consisting in a label and a component in a panel.
static javax.swing.JPanel getGroupPanel(java.lang.String caption)
          Creates a group panel with the specified caption, and a GridBagLayout.
static javax.swing.JPanel getGroupPanel(java.lang.String caption, java.awt.LayoutManager layout)
          Creates a group panel with the specified caption, and layout.
static javax.swing.Icon loadIcon(java.lang.Class c, java.lang.String name)
          Loads an icon as a class resource.
static void showError(java.lang.String message, java.lang.Exception e)
          Shows a "standard" error dialog box.
static void showInformation(java.lang.String message)
          Shows a information message.
static void showWarning(java.lang.String message, java.lang.Exception e)
          Shows a warning message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getGroupPanel

public static javax.swing.JPanel getGroupPanel(java.lang.String caption)
Creates a group panel with the specified caption, and a GridBagLayout.

Parameters:
caption - The panel caption
Returns:
A JPanel with an etched titled border

getGroupPanel

public static javax.swing.JPanel getGroupPanel(java.lang.String caption,
                                               java.awt.LayoutManager layout)
Creates a group panel with the specified caption, and layout.

Parameters:
caption - The panel caption
layout - The panel layout
Returns:
A JPanel with an etched titled border

addField

public static void addField(javax.swing.JPanel panel,
                            java.lang.String label,
                            javax.swing.JComponent c,
                            int row)
Adds a row consisting in a label and a component in a panel.

It supposes the panel uses a GridBoxLayout

Parameters:
panel - Where to put the components row
label - The component label
c - The component
row - The row index in the GridBoxLayout

loadIcon

public static javax.swing.Icon loadIcon(java.lang.Class c,
                                        java.lang.String name)
Loads an icon as a class resource.

Parameters:
c - The class to use for resource search
name - The name of the resource containing the icon
Returns:
The icon

showError

public static void showError(java.lang.String message,
                             java.lang.Exception e)
Shows a "standard" error dialog box.

Parameters:
message - The error message. Should be already internationalized
e - The exception that causes this dialog box to be shown

showWarning

public static void showWarning(java.lang.String message,
                               java.lang.Exception e)
Shows a warning message.

Parameters:
message - The message key
e - The exception causing this message.

showInformation

public static void showInformation(java.lang.String message)
Shows a information message.

Parameters:
message - The message key


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.