jcontrol.ui.vole
Class Container

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by jcontrol.ui.vole.Container
Direct Known Subclasses:
AnimationContainer, Frame, PassiveFrame

public class Container
extends Component

A container is a component that can contain other Vole components.

Components added to a container are tracked in a list. The order of the list will define the component's front-to-back stacking order within the container.

The Vole container does not support virtual coordinates. Thus child-component coordinates always reflect system coordinates.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Field Summary
protected  java.util.Vector children
          The children of the container.
protected  int hasFocus
          Points on the current focus owner in the vector of childrens
static int TRANSFER_BACKWARD
           
static int TRANSFER_FORWARD
          Focus transfer directions
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Container()
          Create a new Container.
Container(int x, int y, int width, int height)
          Create a new Container with the specified dimensions.
 
Method Summary
 void add(Component component)
          Adds a child component to this container.
 Component getFocus()
          Returns the child component that has the focus, null if there is none.
static boolean isCovered(Component c)
          Determines whether the specified Component is covered by another Component which currently has the input focus.
 boolean onKeyEvent(KeyEvent e)
          Tells the focussed child component that a key was pressed.
 void paint()
          Paints all child components.
 void remove()
          Removes this container and all child components.
 void remove(Component component)
          Removes a child component from the container.
 void removeAll()
          Remove all child components from the container.
 void removeFocus()
          Removes the focus from this container structure.
 void requestFocus()
          Sets the focus to this container.
 void setFocus(Component c)
          Set the focus to the given component.
 void setFont(Resource font)
          Set the font for this component.
 void setGraphics(Graphics g)
          Sets the Display context for all child components.
 void setRadioButton(RadioButton radio)
          Set the state of the radio buttons contained in this Container.
 void setVisible(boolean onoff)
          Sets this container and all child comonents visible or invisible.
 boolean transferFocus(Container source)
          Transfers the focus to the next component.
 boolean transferFocus(Container source, int direction)
          Transfers the focus to the next component in given direction.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, setBounds, setParent, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

children

protected java.util.Vector children
The children of the container.


hasFocus

protected int hasFocus
Points on the current focus owner in the vector of childrens


TRANSFER_FORWARD

public static final int TRANSFER_FORWARD
Focus transfer directions

See Also:
Constant Field Values

TRANSFER_BACKWARD

public static final int TRANSFER_BACKWARD
See Also:
Constant Field Values
Constructor Detail

Container

public Container()
Create a new Container.


Container

public Container(int x,
                 int y,
                 int width,
                 int height)
Create a new Container with the specified dimensions.

Parameters:
x - The x-coordinate of the container.
y - The y-coordinate of the container.
width - The width of the container.
height - The height of the container.
Method Detail

add

public void add(Component component)
Adds a child component to this container.


setFont

public void setFont(Resource font)
Set the font for this component.

Overrides:
setFont in class Component
Parameters:
font - The new font.

onKeyEvent

public boolean onKeyEvent(KeyEvent e)
Tells the focussed child component that a key was pressed.

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

setGraphics

public void setGraphics(Graphics g)
Sets the Display context for all child components.

Overrides:
setGraphics in class Component
Parameters:
g - The display context

remove

public void remove()
Removes this container and all child components.

Overrides:
remove in class Component

remove

public void remove(Component component)
Removes a child component from the container.


removeAll

public void removeAll()
Remove all child components from the container.


setVisible

public void setVisible(boolean onoff)
Sets this container and all child comonents visible or invisible.

Overrides:
setVisible in class Component
Parameters:
onoff - true-visible, false-invisible

paint

public void paint()
Paints all child components.

Overrides:
paint in class Component

removeFocus

public void removeFocus()
Removes the focus from this container structure.

Overrides:
removeFocus in class Component

requestFocus

public void requestFocus()
Sets the focus to this container.

Overrides:
requestFocus in class Component

setFocus

public void setFocus(Component c)
Set the focus to the given component.

Parameters:
c - The component to set the focus to.

transferFocus

public boolean transferFocus(Container source,
                             int direction)
Transfers the focus to the next component in given direction.

Parameters:
source - The caller of this method.
direction - TRANSFER_FORWARD or TRANSFER_BACK.
Returns:
True, if the focus was transferred successfully.

transferFocus

public boolean transferFocus(Container source)
Transfers the focus to the next component.

Parameters:
source - The caller of this method.
See Also:
Component.transferFocus()

getFocus

public Component getFocus()
Returns the child component that has the focus, null if there is none.

Returns:
The focussed child component.

isCovered

public static boolean isCovered(Component c)
Determines whether the specified Component is covered by another Component which currently has the input focus.

Parameters:
c - The component to test.

setRadioButton

public void setRadioButton(RadioButton radio)
Set the state of the radio buttons contained in this Container. Only one radio button may be "on" simultaneously.

Parameters:
radio - The radio button to switch "on".