|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjcontrol.ui.wombat.Component
jcontrol.ui.wombat.Frame
public class Frame
A Frame is the starting point for creating a graphical user interface. Only one frame instance should
exist in an application.
An instance of this class should be used to create a keyboard and touch screen based application.
(C) DOMOLOGIC Home Automation GmbH 2005
IFrame,
jcontrol.ui.wombat.TouchFrame,
jcontrol.ui.wombat.FocusFrame| Field Summary | |
|---|---|
static jcontrol.graphics.XGraphics |
graphics
|
static jcontrol.io.Keyboard |
keyboard
Keyboard access |
static jcontrol.io.IPointingDevice |
pointingDevice
|
| Constructor Summary | |
|---|---|
Frame()
Constructs a new Frame. |
|
Frame(jcontrol.graphics.XGraphics graphics,
jcontrol.io.Keyboard keys,
jcontrol.io.IPointingDevice pointingDevice)
Constructs a new Frame. |
|
| Method Summary | |
|---|---|
void |
clearFocus(IContainer icontainer)
Clears the focus tree under the specified container. |
Container |
getContent()
Returns the current content or null if there is none. |
Component |
getOutline()
Returns the current outline or null if there is none. |
int |
onEvent(IContainer container,
Event event)
|
KeyEvent |
onKeyEvent(KeyEvent e)
This method is called when a key has been pressedon the keyboard. |
void |
repaint()
Causes the entire component to be marked as needing to be redrawn. |
boolean |
requestFocus(Component c)
Tries to transfer the keyboard focus to the given component. |
void |
setBackgroundColor(jcontrol.graphics.Color bg)
Sets the background color for this component. |
void |
setBuzzerParams(int hiFreq,
int loFreq,
int length)
|
void |
setContent(Container container)
Sets/replaces the frame's content. |
boolean |
setDirty(java.lang.Object source,
int x,
int y,
int width,
int height,
int state,
boolean b)
Marks all components inside this container that intersect the given bounds to be repainted. |
void |
setFont(jcontrol.io.Resource font)
Sets the font for this component. |
void |
setForegroundColor(jcontrol.graphics.Color fg)
Sets the foreground color for this component. |
void |
setOutline(Component component)
Sets a static element on the frame. |
void |
setTransparentColor(jcontrol.graphics.Color transparentColor)
Sets the transparent color for this component. |
void |
setVisible(boolean visible)
Turns the component visible or invisible. |
boolean |
transferFocus(IContainer c,
int direction)
Transfers the focus in the given container to the next IFocusable element. |
void |
update(jcontrol.graphics.XGraphics g)
Paint all components or a menu. |
| Methods inherited from class jcontrol.ui.wombat.Component |
|---|
getFrame, isEnabled, isVisible, paint, repaintAll, safeExec, setBounds, setDirty, setEnabled, setRedraw, unsafeExec |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, notifyAll, toString, wait |
| Methods inherited from interface jcontrol.ui.wombat.IContainer |
|---|
add, remove, removeAll |
| Field Detail |
|---|
public static jcontrol.graphics.XGraphics graphics
public static jcontrol.io.Keyboard keyboard
public static jcontrol.io.IPointingDevice pointingDevice
| Constructor Detail |
|---|
public Frame()
Constructs a new Frame.
The dimensions are equivalent to the display size. They may be changed by using setBounds().
public Frame(jcontrol.graphics.XGraphics graphics,
jcontrol.io.Keyboard keys,
jcontrol.io.IPointingDevice pointingDevice)
Constructs a new Frame.
The dimensions are equivalent to the display size. They may be changed by using setBounds().
graphics - An instance of a custom display adapter.null, this application will not have keyboard support.keys - An instance of a keyboard interface.pointingDevice - An instance of a pointing device, e.g. jcontrol.io.Touch, or null.null, this application will not have touch support.| Method Detail |
|---|
public void clearFocus(IContainer icontainer)
IFrame
clearFocus in interface IFrameicontainer - a containerpublic Container getContent()
IFramenull if there is none.
getContent in interface IFramenull if there is none.public Component getOutline()
IFramenull if there is none.
getOutline in interface IFramenull if there is none.
public int onEvent(IContainer container,
Event event)
public KeyEvent onKeyEvent(KeyEvent e)
onKeyEvent in interface KeyListenere - The key event.
null if the KeyEvent has been consumed by the KeyListener,KeyListener.onKeyEvent(jcontrol.ui.wombat.event.KeyEvent)public void repaint()
Component
repaint in class Componentpublic boolean requestFocus(Component c)
IFrame
requestFocus in interface IFramec - the component to transfer the focus to
IFocusable.requestFocus()public void setBackgroundColor(jcontrol.graphics.Color bg)
Component
setBackgroundColor in class Componentbg - the background color to set
public void setBuzzerParams(int hiFreq,
int loFreq,
int length)
public void setContent(Container container)
IFrame
Sets/replaces the frame's content. Setting this value to null will destroy the current
content. All handles within the current content will be reset to pave the way for the garbage collector.
In this case, the frame's content will be
null until this method is called again with a new container instance as argument
or until the add(Component) method is called. In this case a new default content will be created
internally.
As the content is the application's root container, this method can easily be used to implement a multi-page
application by creating a number of containers, one for each page. Calling this method with any container
instance will erase the whole display content and replace it with the new one. A good idea to reduce memory
consumption is to set the old content to null before creating a new one. Thus,
the garbage collector can release all memory resources that have been used by the old content
before the new container is created that maybe needs this memory.
public class FirstPage extends Container {
public FirstPage() {
super(2);
// create some components here
add(new Button("OK", ...);
add(new Button("Cancel", ...);
}
}
public class SecondPage extends Container {
public SecondPage() {
super(2);
// create some other components here
add(new Button("Abort", ...);
add(new Button("Retry", ...);
}
}
// important part of the main Application
public class PageDemo extends Frame {
public PageDemo() {
// set first page as content
setContent(new FirstPage());
// make the frame visible
setVisible(true);
...
// some code
...
// delete current content
setContent(null);
// now, it's time for the garbage collector to work
// switch to second page
setContent(new SecondPage());
}
}
setContent in interface IFramecontainer - a container instance or null.
public boolean setDirty(java.lang.Object source,
int x,
int y,
int width,
int height,
int state,
boolean b)
IContainer
setDirty in interface IContainerstate - the state to set
public void setFont(jcontrol.io.Resource font)
Component
setFont in class Componentfont - the new font.public void setForegroundColor(jcontrol.graphics.Color fg)
Component
setForegroundColor in class Componentfg - the foreground color to setpublic void setOutline(Component component)
IFrame
setOutline in interface IFramecomponent - a component to use as static element on the frame.public void setTransparentColor(jcontrol.graphics.Color transparentColor)
Component
setTransparentColor in class ComponenttransparentColor - the transparent color to setpublic void setVisible(boolean visible)
Component
setVisible in class Componentvisible - the visible state to set.
public boolean transferFocus(IContainer c,
int direction)
IFrameIFocusable element. This method is for internal use
and should not be called by the application. This method may be empty in some frame implementations.
transferFocus in interface IFramec - the containerdirection - IFocusable.TRANSFER_FOCUS_FORWARD or IFocusable.TRANSFER__FOCUS_BACKWARDpublic void update(jcontrol.graphics.XGraphics g)
update in class Componentg - the application's graphics object.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||