flatscape.util
Class UIUtils

java.lang.Object
  |
  +--flatscape.util.UIUtils

public class UIUtils
extends java.lang.Object

The UIUtils class contains static utility methods related to common UI related actions.

Copyright (c) 2001 Rutgers, The State University of New Jersey

Since:
flatscape %Version%
Version:
%Version%, %Time%

Field Summary
static java.awt.Insets BUTTON_MARGIN
          The default margin for toolbar icon buttons.
static java.lang.String DEFAULT
          The default icon source.
static java.awt.Dimension ICON_SIZE
          The default icon size for toolbar buttons.
static java.awt.Component parent
          The default parent component for various purposes.
static boolean stackTrace
          If true, stack traces are displayed with each exception dialog.
 
Method Summary
static void centerWindow(java.awt.Component c)
          Centers the given component on the screen.
static javax.swing.JButton createButton(java.lang.String text, char mnemonic)
          Returns a JButton with the specified text and mnemonic.
static javax.swing.JButton createIconButton(java.lang.String source, java.lang.String toolTip)
          Returns a JButton with the specified icon and tool tip.
static javax.swing.JButton createIconButton(java.lang.String source, java.lang.String toolTip, char mnemonic)
          Returns a JButton with the specified icon, tool tip, and mnemonic.
static javax.swing.JMenu createMenu(java.lang.String text, char mnemonic)
          Returns a JMenu with the specified text and mnemonic.
static javax.swing.JMenuItem createMenuItem(java.lang.String text, char mnemonic)
          Returns a JMenuItem with the specified text and mnemonic.
static javax.swing.JMenuItem createMenuItem(java.lang.String text, char mnemonic, java.lang.String accelerator)
          Returns a JMenuItem with the specified text, mnemonic, and accelerator.
static javax.swing.JRadioButton createRadioButton(java.lang.String text, char mnemonic)
          Returns a JRadioButton with the specified text and mnemonic.
static javax.swing.JRadioButtonMenuItem createRadioButtonMenuItem(java.lang.String text, char mnemonic)
          Returns a JRadioButtonMenuItem with the specified text and mnemonic.
static javax.swing.JRadioButtonMenuItem createRadioButtonMenuItem(java.lang.String text, char mnemonic, java.lang.String accelerator)
          Returns a JRadioButtonMenuItem with the specified text, mnemonic, and accelerator.
static javax.swing.ImageIcon getIcon(java.lang.String source)
          Returns an ImageIcon resized to the default toolbar size.
static void scrollToBottom(javax.swing.JScrollPane scrollPane)
          Forces a JScrollPane to scroll to the bottom left extreme.
static void scrollToTop(javax.swing.JScrollPane scrollPane)
          Forces a JScrollPane to scroll to the top left extreme.
static void showExceptionDialog(java.lang.String title, java.lang.Exception e)
          Displays an error dialog detailing an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

public static java.awt.Component parent
The default parent component for various purposes. This static variable should be set as soon as it is available.


DEFAULT

public static final java.lang.String DEFAULT
The default icon source.

See Also:
Constant Field Values

stackTrace

public static boolean stackTrace
If true, stack traces are displayed with each exception dialog.


ICON_SIZE

public static final java.awt.Dimension ICON_SIZE
The default icon size for toolbar buttons. Set to 32 by 32 pixels.


BUTTON_MARGIN

public static final java.awt.Insets BUTTON_MARGIN
The default margin for toolbar icon buttons. Set to 0 pixels.

Method Detail

showExceptionDialog

public static void showExceptionDialog(java.lang.String title,
                                       java.lang.Exception e)
Displays an error dialog detailing an exception. The full stack trace will be shown if the static variable stackTrace is true.


centerWindow

public static void centerWindow(java.awt.Component c)
Centers the given component on the screen.


getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String source)
Returns an ImageIcon resized to the default toolbar size.


createIconButton

public static javax.swing.JButton createIconButton(java.lang.String source,
                                                   java.lang.String toolTip)
Returns a JButton with the specified icon and tool tip.


createIconButton

public static javax.swing.JButton createIconButton(java.lang.String source,
                                                   java.lang.String toolTip,
                                                   char mnemonic)
Returns a JButton with the specified icon, tool tip, and mnemonic.


createButton

public static javax.swing.JButton createButton(java.lang.String text,
                                               char mnemonic)
Returns a JButton with the specified text and mnemonic.


createMenu

public static javax.swing.JMenu createMenu(java.lang.String text,
                                           char mnemonic)
Returns a JMenu with the specified text and mnemonic.


createMenuItem

public static javax.swing.JMenuItem createMenuItem(java.lang.String text,
                                                   char mnemonic)
Returns a JMenuItem with the specified text and mnemonic.


createMenuItem

public static javax.swing.JMenuItem createMenuItem(java.lang.String text,
                                                   char mnemonic,
                                                   java.lang.String accelerator)
Returns a JMenuItem with the specified text, mnemonic, and accelerator.


createRadioButton

public static javax.swing.JRadioButton createRadioButton(java.lang.String text,
                                                         char mnemonic)
Returns a JRadioButton with the specified text and mnemonic.


createRadioButtonMenuItem

public static javax.swing.JRadioButtonMenuItem createRadioButtonMenuItem(java.lang.String text,
                                                                         char mnemonic)
Returns a JRadioButtonMenuItem with the specified text and mnemonic.


createRadioButtonMenuItem

public static javax.swing.JRadioButtonMenuItem createRadioButtonMenuItem(java.lang.String text,
                                                                         char mnemonic,
                                                                         java.lang.String accelerator)
Returns a JRadioButtonMenuItem with the specified text, mnemonic, and accelerator.


scrollToTop

public static void scrollToTop(javax.swing.JScrollPane scrollPane)
Forces a JScrollPane to scroll to the top left extreme.


scrollToBottom

public static void scrollToBottom(javax.swing.JScrollPane scrollPane)
Forces a JScrollPane to scroll to the bottom left extreme.



Copyright (c) 2003 Rutgers, The State University of New Jersey