| java.lang.Object com.jeta.open.gui.utils.JETAToolbox
JETAToolbox | public class JETAToolbox (Code) | | Some common utility functions for GUI stuff.
author: Jeff Tassin |
Method Summary | |
public static void | addItems(JComboBox cbox, Object[] items) | public static int | calculateAverageTextWidth(Component comp, int numCharacters) Calculates the width of an average string of text. | public static void | calculateReasonableComponentSize(Dimension d) Sets the size of the dimension to some reasonable value. | public static void | centerFrame(Window frame, float xpctWidth, float ypctWidth) This method centers and sizes a frame window on the screen. | public static void | centerWindow(Window frame) This method centers a window window on the screen. | public static void | centerWindowChangeWidth(Window frame, float xpctWidth) This method centers a window window and changes the width on the screen.
The caller must pass the x percentages of screen width. | public static void | copyToClipboard(String str) | public static Dialog | createDialog(Class dlgclass, Component owner, boolean bModal) This method creates a dialog of the type class. | public static int | getFrameBorderThickness() | public static int | getTitleBarHeight() | public static JETADialog | invokeDialog(JETAPanel view, Component owner, String title) Creates and displays a model JETADialog using the given view as the
content pane. | public static JETADialog | invokeDialog(JETAPanel view, Component owner, String title, JComponent initialFocus) Creates and displays a model JETADialog using the given view as the
content pane. | public static boolean | isAquaLookAndFeel() Returns true if running OS X Aqua look and feel. | public static boolean | isOSX() | public static boolean | isWindows() | public static boolean | isWindowsLookAndFeel() true if we are currently in the windows look and feel. | public static void | setReasonableWindowSize(Component window, Dimension d) Sets the size of the given window to the passed in dimension. |
APPLICATION_FRAME | final public static String APPLICATION_FRAME(Code) | | |
addItems | public static void addItems(JComboBox cbox, Object[] items)(Code) | | Adds an array or collection of items to a combo box
|
calculateAverageTextWidth | public static int calculateAverageTextWidth(Component comp, int numCharacters)(Code) | | Calculates the width of an average string of text.
Parameters: comp - the component whose font metrics will determine the width Parameters: numCharacters - the number of characters to use to calculate the length |
calculateReasonableComponentSize | public static void calculateReasonableComponentSize(Dimension d)(Code) | | Sets the size of the dimension to some reasonable value. If the given
dimension is larger than the screen size, then we set the window to 80%
of the screen size. Otherwise, we leave it alone
Parameters: d - the dimension of the window to set |
centerFrame | public static void centerFrame(Window frame, float xpctWidth, float ypctWidth)(Code) | | This method centers and sizes a frame window on the screen. The caller
must pass the x and y percentages of screen width/height.
|
centerWindow | public static void centerWindow(Window frame)(Code) | | This method centers a window window on the screen. The caller must pass
the x and y percentages of screen width/height.
|
centerWindowChangeWidth | public static void centerWindowChangeWidth(Window frame, float xpctWidth)(Code) | | This method centers a window window and changes the width on the screen.
The caller must pass the x percentages of screen width. The height
remains unchanged
|
copyToClipboard | public static void copyToClipboard(String str)(Code) | | Copies to the clipboard the given string
|
createDialog | public static Dialog createDialog(Class dlgclass, Component owner, boolean bModal)(Code) | | This method creates a dialog of the type class. It assumes that the
dialog will have constructors that have the following form: ctor( JDialog
owner, boolean bmodal ) ctor( Frame owner, boolean bmodal )
This method interogates the owner object. If this object is a JDialog or
Frame, then we call the appropriate constructor for the class. If this
object is a JComponent, then we get the objects owner window and
determine if that is a JDialog or Frame.
Parameters: dlgclass - the class of the dialog we want to create Parameters: owner - the owner of the new dialog. This object can be indirectly anowner. For example, you can pass in a JPanel as the owner.This method will detect this and get the appropriate owner ofthe JPanel Parameters: bModal - true if you want the dialog to be modal |
getFrameBorderThickness | public static int getFrameBorderThickness()(Code) | | the thickness (in pixels) of the border on a frame or dialogwindow Currently, this is hard coded until I figure out a way toget this value. |
getTitleBarHeight | public static int getTitleBarHeight()(Code) | | the height (in pixels) of the titlebar on a frame or dialogwindow Currently, this is hard coded until I figure out a way toget this value. |
invokeDialog | public static JETADialog invokeDialog(JETAPanel view, Component owner, String title)(Code) | | Creates and displays a model JETADialog using the given view as the
content pane. The dialog is centered on the screen and it's modal parent
is set to null.
|
invokeDialog | public static JETADialog invokeDialog(JETAPanel view, Component owner, String title, JComponent initialFocus)(Code) | | Creates and displays a model JETADialog using the given view as the
content pane. The dialog is centered on the screen and it's modal parent
is set to null.
Parameters: view - the main content panel for the dialog Parameters: title - the dialog's title Parameters: initialFocus - the component that will have the initial focus |
isAquaLookAndFeel | public static boolean isAquaLookAndFeel()(Code) | | Returns true if running OS X Aqua look and feel.
|
isOSX | public static boolean isOSX()(Code) | | true if running Mac OS X |
isWindows | public static boolean isWindows()(Code) | | true if running Windows |
isWindowsLookAndFeel | public static boolean isWindowsLookAndFeel()(Code) | | true if we are currently in the windows look and feel. This L&Fhas different focus issues with the popup |
setReasonableWindowSize | public static void setReasonableWindowSize(Component window, Dimension d)(Code) | | Sets the size of the given window to the passed in dimension. However, if
the given dimension is larger than the screen size, then we set the
window to 80% of the screen size
Parameters: window - the window whose size we are setting Parameters: d - the dimension of the window to set |
|
|