uic.widgets
Class MainWindow

java.lang.Object
  extended byuic.widgets.AbstractWindow
      extended byuic.widgets.MainWindow

public class MainWindow
extends AbstractWindow

MainWindow is the application window for any application you will create. In the Single Document Interface (which surpasses the Mutiple Document Interface) way of working every MainWindow equals one document. To create a new application you can instanciate a new MainWindow class and put your content in it followed by a call to show() Details like window positioning and size can be ignored, the MainWindow takes care of that.

Notice that closing (the last) main window will exit java automatically.


Nested Class Summary
static class MainWindow.GlassPaneListener
          Class that stops all events to the window when we are in 'help' mode to show a whatIs message.
static class MainWindow.RootPane
          Class that is a rootpane on the MainWindow in order to have the statusBar be correctly placed.
 
Field Summary
protected static int mainWindowCount
           
protected static MetalTheme myTheme
          A UICompiler theme (most of the time) that is created for this window
 
Fields inherited from class uic.widgets.AbstractWindow
internalWindow
 
Constructor Summary
MainWindow()
          Empty constructor to create a new window without a specific name.
MainWindow(String title)
          Create a new window with title.
 
Method Summary
 void cancelHelpMode()
          Cancels the mode started with goToHelpMode.
 void closeWindowSlot()
           
protected  Window createInternalWindow(Dialog owner, String title, boolean modal)
           
protected  Window createInternalWindow(Frame owner, String title, boolean modal)
           
protected  MetalTheme createLookAndFeel()
          Called from constructor to set a look and feel on the new Frame.
protected  StatusBar createStatusBar()
          Override this method to provide your own StatusBar implementation.
 JFrame getFrame()
          return the top level JFrame which shows the visual MainWindow
 JMenuBar getMenuBar()
          Return the menuBar.
 StatusBar getStatusBar()
          return the statusBar.
 JToolBar getToolbar()
          Returns the toolbar.
 JToolBar getToolBar(String name)
          Returns the toolbar with the specified name.
 void goToHelpMode()
          Go to a mode where the cursor changes to a question mark and clicking on a widget will then trigger a popup with information about the widget.
protected  boolean queryClose()
          Called before the window is closed, either by the user or indirectly by the session manager.
 void setBusy(boolean busy)
          Set an hourglass cursor on this window when true.
 void setCaption(String name)
          Set the name that is displaed in the window manager
 int show(Point location, Dimension size)
          Overloaded, see AbstractWindow for details.
 void shutdown()
          Called when the application exits.
 TranslationInterface translate()
           
static void useUICTheme(boolean enabled)
          To automatically set the UICTheme to the newly created window this should be set to true before instanciating the first mainWindow.
 
Methods inherited from class uic.widgets.AbstractWindow
getBounds, getDialogSizePanel, getLocation, getRPContainer, getSize, positionDialog, positionDialog, setComponent, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainWindowCount

protected static int mainWindowCount

myTheme

protected static MetalTheme myTheme
A UICompiler theme (most of the time) that is created for this window

Constructor Detail

MainWindow

public MainWindow()
Empty constructor to create a new window without a specific name.


MainWindow

public MainWindow(String title)
Create a new window with title.

Method Detail

createInternalWindow

protected Window createInternalWindow(Frame owner,
                                      String title,
                                      boolean modal)
Specified by:
createInternalWindow in class AbstractWindow

createInternalWindow

protected Window createInternalWindow(Dialog owner,
                                      String title,
                                      boolean modal)
Specified by:
createInternalWindow in class AbstractWindow

useUICTheme

public static void useUICTheme(boolean enabled)
To automatically set the UICTheme to the newly created window this should be set to true before instanciating the first mainWindow. The default is true.

Parameters:
enabled - set UICTheme to new created MainWinow instances.

createLookAndFeel

protected MetalTheme createLookAndFeel()
Called from constructor to set a look and feel on the new Frame.


getFrame

public JFrame getFrame()
return the top level JFrame which shows the visual MainWindow

Returns:
the top level JFrame which shows the visual MainWindow

show

public int show(Point location,
                Dimension size)
Overloaded, see AbstractWindow for details.

Overrides:
show in class AbstractWindow
Parameters:
location - the x and y coordinates on the screen where the dialog should appear, can be null to use parents position.
size - a size hint for the dialog, can be null to use default based on the preferredSize.
Returns:
always 1

getToolbar

public JToolBar getToolbar()
Returns the toolbar. If the toolbar does not exist one will be created.

Returns:
the toolbar

getToolBar

public JToolBar getToolBar(String name)
Returns the toolbar with the specified name. If the toolbar does not exist one will be created.

Returns:
the toolbar

getMenuBar

public JMenuBar getMenuBar()
Return the menuBar. When none is found, one will be created.

Returns:
the menubar for this MainWindow

getStatusBar

public StatusBar getStatusBar()
return the statusBar. When none is found, one will be created.

Returns:
the statusBar for this MainWindow

createStatusBar

protected StatusBar createStatusBar()
Override this method to provide your own StatusBar implementation.


setBusy

public void setBusy(boolean busy)
Set an hourglass cursor on this window when true.


setCaption

public void setCaption(String name)
Set the name that is displaed in the window manager


closeWindowSlot

public void closeWindowSlot()

queryClose

protected boolean queryClose()
Called before the window is closed, either by the user or indirectly by the session manager. The purpose of this function is to prepare the window in a way that it is safe to close it, i.e. without the user losing some data. Default implementation returns true. Returning false will cancel the closing


shutdown

public void shutdown()
Called when the application exits. The purpose of this function is to exit the JVM, and will only be called when all MainWindow instances have quit. The default implementation is a single 'System.exit(0);', but it is wise to call this method (using super.shutdown()) at the end if you plan to override it.


goToHelpMode

public void goToHelpMode()
Go to a mode where the cursor changes to a question mark and clicking on a widget will then trigger a popup with information about the widget.


cancelHelpMode

public void cancelHelpMode()
Cancels the mode started with goToHelpMode.

See Also:
goToHelpMode()

translate

public TranslationInterface translate()


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence