|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IFrame
An application must have (or self be) a Frame
instance.
A frame represents the very top level element of the application's component tree. Here, all
drawing action is managed. The frame is also responsible for the control of user input such as
touch or keyboard actions. The frame consists of two main parts: The outline and the content.
Component
(may even a Container
) that represents the
static part of an application. This can be a menu, a logo, a background image, an analog clock somewhere
in a corner or whatever.
The outline is optional and should normally not be replaced at run-time.Container
that represents the dynamic part of an application. Adding components
to the frame means to add components to the frame's content. The content can even be replaced completely by the
application using the setContent
method.
Note: It is not recommended to access components using multiple threads at the same time. This may cause synchronization problems resulting in unexpected behaviour.
(C) DOMOLOGIC Home Automation GmbH 2005 - 2007
Method Summary | |
---|---|
void |
clearFocus(IContainer container)
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. |
boolean |
requestFocus(Component component)
Tries to transfer the keyboard focus to the given component. |
void |
setContent(Container container)
Sets/replaces the frame's content. |
void |
setOutline(Component component)
Sets a static element on the frame. |
boolean |
transferFocus(IContainer c,
int direction)
Transfers the focus in the given container to the next IFocusable element. |
Methods inherited from interface jcontrol.ui.wombat.IContainer |
---|
add, remove, removeAll, setDirty |
Method Detail |
---|
void setContent(Container container)
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()); } }
container
- a container instance or null
.Container getContent()
null
if there is none.
null
if there is none.void setOutline(Component component)
component
- a component to use as static element on the frame.Component getOutline()
null
if there is none.
null
if there is none.boolean requestFocus(Component component)
component
- the component to transfer the focus to
IFocusable.requestFocus()
void clearFocus(IContainer container)
container
- a containerboolean transferFocus(IContainer c, int direction)
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.
c
- the containerdirection
- IFocusable.TRANSFER_FOCUS_FORWARD or IFocusable.TRANSFER__FOCUS_BACKWARD
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |