Jadex 0.96-beta1

jadex.util
Class SGUI

java.lang.Object
  extended by jadex.util.SGUI

public class SGUI
extends Object

Static helper class with useful gui related methods.


Field Summary
static String AUTO_ADJUST
          This property can be set on components to be automatically adjusted to equal sizes.
 
Constructor Summary
SGUI()
           
 
Method Summary
static void adjustComponentSizes(Container parent)
          Adjust all marked components to equal sizes according to their miminum, maximum, and preferred sizes.
static void adjustComponentSizes(JComponent[] components)
          Adjust components to equal sizes according to their miminum, maximum, and preferred sizes.
static Point calculateMiddlePosition(Window win)
          Calculate the middle position of a window relativ to
static Point calculateMiddlePosition(Window outer, Window win)
          Calculate the middle position of a window relativ to
static Action createAction(String name, Icon icon, ActionListener listener)
          Create an action.
static JMenuBar createMenuBar(Action[] actions)
          Create a menu bar, given a list of actions.
static JToolBar createToolBar(String name, Action[] actions)
          Create a tool bar, given a list of actions.
static Window getWindowParent(Component comp)
          Get the window parent if any.
static Object makeIcon(Class baseclass, String imgloc)
          Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon for the specified gifFile filename.
static void renderObject(Graphics g, Component comp, double cellw, double cellh, int x, int y, int gridwidth)
          Render an object on a grid.
static void showMessageDialog(Component parent, Object message, String title, int msgtype)
          Show an non-model message dialog.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTO_ADJUST

public static final String AUTO_ADJUST
This property can be set on components to be automatically adjusted to equal sizes.

See Also:
Constant Field Values
Constructor Detail

SGUI

public SGUI()
Method Detail

createMenuBar

public static JMenuBar createMenuBar(Action[] actions)
Create a menu bar, given a list of actions.

Parameters:
actions - The actions (null is mapped to separator).
Returns:
A menu bar with a menu containing the actions.

createToolBar

public static JToolBar createToolBar(String name,
                                     Action[] actions)
Create a tool bar, given a list of actions.

Parameters:
name - The name of the toolbar.
actions - The actions (null is mapped to separator).
Returns:
A tool bar containing the actions.

createAction

public static Action createAction(String name,
                                  Icon icon,
                                  ActionListener listener)
Create an action.

Parameters:
name - The name.
icon - The path to the icon.
listener - The action listener.
Returns:
The action.

makeIcon

public static Object makeIcon(Class baseclass,
                              String imgloc)
Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon for the specified gifFile filename.


renderObject

public static void renderObject(Graphics g,
                                Component comp,
                                double cellw,
                                double cellh,
                                int x,
                                int y,
                                int gridwidth)
Render an object on a grid.

Parameters:
g - The graphics object.
comp - The object to render.
cellw - The cell width.
cellh - The cell height.

calculateMiddlePosition

public static Point calculateMiddlePosition(Window win)
Calculate the middle position of a window relativ to


calculateMiddlePosition

public static Point calculateMiddlePosition(Window outer,
                                            Window win)
Calculate the middle position of a window relativ to


getWindowParent

public static Window getWindowParent(Component comp)
Get the window parent if any.

Parameters:
comp - The component.
Returns:
The window if any.

showMessageDialog

public static void showMessageDialog(Component parent,
                                     Object message,
                                     String title,
                                     int msgtype)
Show an non-model message dialog.


adjustComponentSizes

public static void adjustComponentSizes(JComponent[] components)
Adjust components to equal sizes according to their miminum, maximum, and preferred sizes.


adjustComponentSizes

public static void adjustComponentSizes(Container parent)
Adjust all marked components to equal sizes according to their miminum, maximum, and preferred sizes. The mark is given by setting the AUTO_ADJUST property to an arbitrary value.


Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.