mauda
Class MAUDA

java.lang.Object
  extended by mauda.MAUDA

public class MAUDA
extends java.lang.Object

Stores global values.
At the moment only a reference to the main application frame, and a bounds-calculator for new windows that should lie relative to the main frame.

Author:
Markus Krebs

Constructor Summary
MAUDA()
           
 
Method Summary
static javax.swing.JFrame getApplicationMainFrame()
          Gets the main application frame.
static java.awt.Rectangle getRelativeBounds(int w, int h)
          Returns a Rectangle-Object which contains the bounds of a newly to open window.
static void setApplicationMainFrame(javax.swing.JFrame frame)
          Sets the main application frame.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MAUDA

public MAUDA()
Method Detail

setApplicationMainFrame

public static void setApplicationMainFrame(javax.swing.JFrame frame)
Sets the main application frame. This is necessary to give new opened windows a reference to the main window (e.g. JOptionPane should achieve a reference)

Parameters:
frame - main application frame

getApplicationMainFrame

public static javax.swing.JFrame getApplicationMainFrame()
Gets the main application frame. Mostly used within JOptionPane.

Returns:
main application frame

getRelativeBounds

public static java.awt.Rectangle getRelativeBounds(int w,
                                                   int h)
Returns a Rectangle-Object which contains the bounds of a newly to open window. This new window will be relative to the main-window positioned.
This method needs the width and height of the new window, that should be opened. Then the positioning values x and y are calculated, so that the new window-bounds lies in the center of then main application frame. So the typical use is:
frame.setBounds(MAUDA.getRelativeBounds(300,100));

Parameters:
w - The width of the new window
h - The height of the new window
Returns:
The Bounds of the new window