waba.ui
Class MainWindow

waba.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Container
              |
              +--waba.ui.Window
                    |
                    +--waba.ui.MainWindow
Direct Known Subclasses:
Welcome

public class MainWindow
extends Window

MainWindow is the main window of a UI based application.

All Waba programs with a user-interface must have a main window.

Here is an example showing a basic application:

 public class MyProgram extends MainWindow
 {
 public void onStart()
  {
  ... initialization code ...
  Label label = new Label("Name:");
  label.setRect(..);
  add(label);
  }
 }
 


Field Summary
static Font defaultFont
           
 
Fields inherited from class waba.ui.Window
_controlEvent, _keyEvent, _penEvent
 
Fields inherited from class waba.ui.Container
children, tail
 
Fields inherited from class waba.ui.Control
height, next, parent, prev, width, x, y
 
Constructor Summary
MainWindow()
          Constructs a main window.
 
Method Summary
 void _onTimerTick()
          Called by the VM to process timer interrupts.
protected  void _setTimerInterval(int milliseconds)
          Called to set the VM's timer interval.
protected  Timer addTimer(Control target, int millis)
          Adds a timer to a control.
 void exit(int exitCode)
          Notifies the application that it should stop executing and exit.
 FontMetrics getFontMetrics(Font font)
          Returns the font metrics for a given font.
static MainWindow getMainWindow()
          Returns the MainWindow of the current application.
 void onExit()
          Called just before an application exits.
 void onStart()
          Called when an application starts.
 boolean removeTimer(Timer timer)
          Removes a timer.
 
Methods inherited from class waba.ui.Window
_doPaint, _postEvent, damageRect, getFocus, setFocus
 
Methods inherited from class waba.ui.Container
add, findChild, paintChildren, remove
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getNext, getParent, getRect, onEvent, onPaint, postEvent, repaint, setRect
 
Methods inherited from class waba.lang.Object
toString
 

Field Detail

defaultFont

public static final Font defaultFont
Constructor Detail

MainWindow

public MainWindow()
Constructs a main window.
Method Detail

exit

public void exit(int exitCode)
Notifies the application that it should stop executing and exit. It will exit after executing any pending events. If the underlying system supports it, the exitCode passed is returned to the program that started the app.

getMainWindow

public static MainWindow getMainWindow()
Returns the MainWindow of the current application.

getFontMetrics

public FontMetrics getFontMetrics(Font font)
Returns the font metrics for a given font.
Overrides:
getFontMetrics in class Control

addTimer

protected Timer addTimer(Control target,
                         int millis)
Adds a timer to a control. This method is protected, the public method to add a timer to a control is the addTimer() method in the Control class.

removeTimer

public boolean removeTimer(Timer timer)
Removes a timer. This method returns true if the timer was found and removed and false if the given timer could not be found.
Overrides:
removeTimer in class Control

onExit

public void onExit()
Called just before an application exits.

onStart

public void onStart()
Called when an application starts. Initialization code is usually either placed in this method or simply in the app's constructor. This method is called just after the app's constructor is called.

_onTimerTick

public void _onTimerTick()
Called by the VM to process timer interrupts. This method is not private to prevent the compiler from removing it during optimization.

_setTimerInterval

protected void _setTimerInterval(int milliseconds)
Called to set the VM's timer interval. This method is not public, you should use the addTimer() method in the Control class to create a timer.