jcontrol.ui.vole
Class Frame

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by jcontrol.ui.vole.Container
          extended by jcontrol.ui.vole.Frame
All Implemented Interfaces:
Runnable, ActionListener

public class Frame
extends Container
implements Runnable, ActionListener

A Frame is the starting point for creating a graphical user interface. Though several Frame instances may exist simultaneously, only one instance must be visible at the same time.

The Frame class is a manager for user interaction and maps input/output facilities such as keyboard or backlight to an underlying class framework.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Field Summary
protected static Graphics graphics
          Graphics access
protected  int key_d
           
protected  int key_D
           
protected  int key_L
           
protected  int key_R
           
protected  int key_S
           
protected  int key_u
           
protected  int key_U
           
protected static Keyboard keyboard
          Keyboard access
protected  MenuInterface menu
          The main menu
protected static Frame visibleFrame
          The currently visible frame (only one simultaneously)
 
Fields inherited from class jcontrol.ui.vole.Container
children, hasFocus, TRANSFER_BACKWARD, TRANSFER_FORWARD
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Frame()
          Constructs a new Frame.
Frame(Graphics graphics, Keyboard keys)
          Constructs a new Frame.
 
Method Summary
 MenuInterface getMenu()
          Get the frame's current menu.
 void onActionEvent(ActionEvent event)
          Handle ActionEvents.
 boolean onKeyEvent(KeyEvent event)
          Handle KeyEvents.
 void paint()
          Paint all components or a menu.
 void remove()
          Destroys this frame and all child components.
 MenuInterface removeMenu()
          Remove a menu from the frame.
 void run()
          This is the main event loop of any user interface.
 void setMenu(MenuInterface m)
          Add a menu to this frame.
 void setVisible(boolean b)
          Shows or hides the frame.
 void show()
          Shows the frame.
 
Methods inherited from class jcontrol.ui.vole.Container
add, getFocus, isCovered, remove, removeAll, removeFocus, requestFocus, setFocus, setFont, setGraphics, setRadioButton, transferFocus, transferFocus
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, setBounds, setParent, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

keyboard

protected static Keyboard keyboard
Keyboard access


graphics

protected static Graphics graphics
Graphics access


visibleFrame

protected static Frame visibleFrame
The currently visible frame (only one simultaneously)


menu

protected MenuInterface menu
The main menu


key_u

protected int key_u

key_U

protected int key_U

key_d

protected int key_d

key_D

protected int key_D

key_S

protected int key_S

key_L

protected int key_L

key_R

protected int key_R
Constructor Detail

Frame

public Frame()

Constructs a new Frame.

The dimensions are equivalent to the display size. They may be changed by using setBounds().


Frame

public Frame(Graphics graphics,
             Keyboard keys)

Constructs a new Frame.

The dimensions are equivalent to the display size. They may be changed by using setBounds().

Parameters:
graphics - An instance of a custom display adapter.
keys - An instance of a keyboard interface.
Method Detail

setVisible

public void setVisible(boolean b)
Shows or hides the frame. When the frame is hidden, all event handlers are stopped.

Overrides:
setVisible in class Container
Parameters:
b - true-visible, false-invisible
See Also:
Component.setVisible(boolean)

show

public void show()
Shows the frame. Same as setVisible(true);


run

public void run()
This is the main event loop of any user interface. The method monitors input and output facilitys such as keyboard or backlight and forwards activity in the form of events to the sub-components.

Specified by:
run in interface Runnable
See Also:
Thread.run()

remove

public void remove()
Destroys this frame and all child components.

Overrides:
remove in class Container

onActionEvent

public void onActionEvent(ActionEvent event)
Handle ActionEvents.

Specified by:
onActionEvent in interface ActionListener
Overrides:
onActionEvent in class Component
Parameters:
event - the ActionEvent

onKeyEvent

public boolean onKeyEvent(KeyEvent event)
Handle KeyEvents.

Overrides:
onKeyEvent in class Container
Parameters:
event - the KeyEvent to pass on
Returns:
This method returns false when the KeyEvent has been consumed.

setMenu

public void setMenu(MenuInterface m)
Add a menu to this frame. Any prior added menu is overwritten.

Parameters:
m - The menu

getMenu

public MenuInterface getMenu()
Get the frame's current menu.

Returns:
Menu The current menu or null.

removeMenu

public MenuInterface removeMenu()
Remove a menu from the frame.

Returns:
Menu The menu which was removed or null.

paint

public void paint()
Paint all components or a menu.

Overrides:
paint in class Container