|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.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 - 2007
IFrame
,
jcontrol.ui.wombat.TouchFrame
,
jcontrol.ui.wombat.FocusFrame
Field Summary | |
---|---|
static XGraphics |
graphics
|
static Keyboard |
keyboard
Keyboard access |
static IPointingDevice |
pointingDevice
|
Constructor Summary | |
---|---|
Frame()
Constructs a new Frame. |
|
Frame(XGraphics graphics,
Keyboard keys,
IPointingDevice pointingDevice)
Constructs a new Frame. |
Method Summary | |
---|---|
void |
add(Component component)
Deprecated. |
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 |
remove(Component component)
Deprecated. |
void |
removeAll()
Deprecated. |
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(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(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(Resource font)
Sets the font for this component. |
void |
setForegroundColor(Color fg)
Sets the foreground color for this component. |
void |
setOutline(Component component)
Sets a static element on the frame. |
void |
setTransparentColor(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(XGraphics g)
Paint all components or a menu. |
Methods inherited from class jcontrol.ui.wombat.Component |
---|
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, paint, redrawInternalAndParent, repaintAll, safeExec, setBackgroundColorInternal, setBounds, setDirty, setEnabled, setForegroundColorInternal, setParametersInternal, setRedraw, unsafeExec |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public static Keyboard keyboard
public static IPointingDevice pointingDevice
public static XGraphics graphics
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(XGraphics graphics, Keyboard keys, 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 setBuzzerParams(int hiFreq, int loFreq, int length)
public void setVisible(boolean visible)
Component
setVisible
in class Component
visible
- the visible state to set.public int onEvent(IContainer container, Event event)
public boolean requestFocus(Component c)
IFrame
requestFocus
in interface IFrame
c
- the component to transfer the focus to
IFocusable.requestFocus()
public boolean transferFocus(IContainer c, int direction)
IFrame
IFocusable
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 IFrame
c
- the containerdirection
- IFocusable.TRANSFER_FOCUS_FORWARD or IFocusable.TRANSFER__FOCUS_BACKWARDpublic void clearFocus(IContainer icontainer)
IFrame
clearFocus
in interface IFrame
icontainer
- a containerpublic void update(XGraphics g)
update
in class Component
g
- the application's graphics object.public boolean setDirty(Object source, int x, int y, int width, int height, int state, boolean b)
IContainer
setDirty
in interface IContainer
state
- the state to set
public void add(Component component)
IContainer
add
in interface IContainer
component
- the component to add.IContainer.add(jcontrol.ui.wombat.Component)
public void remove(Component component)
IContainer
remove
in interface IContainer
component
- the component to removeIContainer.remove(jcontrol.ui.wombat.Component)
public void removeAll()
IContainer
removeAll
in interface IContainer
IContainer.removeAll()
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 IFrame
container
- a container instance or null
.public Container getContent()
IFrame
null
if there is none.
getContent
in interface IFrame
null
if there is none.public void repaint()
Component
repaint
in class Component
public void setOutline(Component component)
IFrame
setOutline
in interface IFrame
component
- a component to use as static element on the frame.public KeyEvent onKeyEvent(KeyEvent e)
onKeyEvent
in interface KeyListener
e
- The key event.
null
if the KeyEvent has been consumed by the KeyListener,KeyListener.onKeyEvent(jcontrol.ui.wombat.event.KeyEvent)
public void setFont(Resource font)
Component
setFont
in class Component
font
- the new font.public void setForegroundColor(Color fg)
Component
setForegroundColor
in class Component
fg
- the foreground color to setpublic void setTransparentColor(Color transparentColor)
Component
setTransparentColor
in class Component
transparentColor
- the transparent color to setpublic void setBackgroundColor(Color bg)
Component
setBackgroundColor
in class Component
bg
- the background color to setpublic Component getOutline()
IFrame
null
if there is none.
getOutline
in interface IFrame
null
if there is none.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |