|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcontrol.ui.wombat.Component
public abstract class Component
A Component is an object having a graphical representation that can be displayed on the screen and that can interact with the user. Examples of components are the buttons, labels and checkboxes etc of a typical graphical user interface.
The Component
class is the abstract superclass of all components in this library.
Class Component
may also be extended directly to create your own components.
To work properly, components must be part of a container-tree (see Container
), with a Frame instance
as top-level element.
There are two different types of components. Some components, such as labels or borders don't have any
interactive behaviour. Their only purpose is displaying text, images, measuring values or whatever. They
can neither be selected by any user action nor they can fire events.
Interactive components, such as buttons, combo boxes, list boxes, radio buttons etc, are controllable
by the user via keyboard and/or touch screen and they can even fire action events.
Note: It is not recommended to access components using multiple threads at the same time. This may cause synchronization problems resulting in unexpected behaviour.
Get more information and demo applications at www.jcontrol.org.(c) Copyright 2005 DOMOLOGIC GmbH
Field Summary | |
---|---|
jcontrol.graphics.Color |
backgroundColor
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_BACKGROUND
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_DARK_SHADOW
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_FOREGROUND
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_FOREGROUND_INACTIVE
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_HIGHLIGHT_SHADOW
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_LIGHT_SHADOW
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_LIST_BACKGROUND
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_NORMAL_SHADOW
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_SELECTION_TEXT
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE
|
static jcontrol.graphics.Color |
COLOR_COMPONENT_SELECTION_TEXT_INACTIVE
|
jcontrol.graphics.Color |
foregroundColor
|
IFrame |
frame
|
int |
height
The component's height. |
IContainer |
parent
The parent container of the component. |
int |
state
The state control flag. |
jcontrol.graphics.Color |
transparentColor
|
int |
width
The component's width. |
int |
x
The component's x location. |
int |
y
The component's y location. |
Constructor Summary | |
---|---|
Component()
|
Method Summary | |
---|---|
IFrame |
getFrame()
Returns the applications root IFrame object. |
boolean |
isEnabled()
|
boolean |
isVisible()
Returns true if this component is set visible,
and false otherwise. |
void |
paint(jcontrol.graphics.XGraphics g)
This method should not be called from the application. |
void |
repaint()
Causes the entire component to be marked as needing to be redrawn. |
void |
repaintAll()
Causes the entire component to be marked as needing to be redrawn. |
static void |
safeExec(java.lang.Runnable runnable)
Causes the run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
void |
setBackgroundColor(jcontrol.graphics.Color background)
Sets the background color for this component. |
void |
setBounds(int x,
int y,
int width,
int height)
Set the dimensions of this component. |
void |
setDirty(int state,
boolean onoff)
This method should not be called from the application. |
void |
setEnabled(boolean enabled)
Sets the enabled state of this component. |
void |
setFont(jcontrol.io.Resource font)
Sets the font for this component. |
void |
setForegroundColor(jcontrol.graphics.Color foreground)
Sets the foreground color for this component. |
void |
setRedraw(boolean onoff)
Disables/enables drawing for this component. |
void |
setTransparentColor(jcontrol.graphics.Color transparentColor)
Sets the transparent color for this component. |
void |
setVisible(boolean visible)
Turns the component visible or invisible. |
static void |
unsafeExec(java.lang.Runnable runnable)
Causes the run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
void |
update(jcontrol.graphics.XGraphics g)
This method should not be called from the application. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public jcontrol.graphics.Color backgroundColor
public static final jcontrol.graphics.Color COLOR_COMPONENT_BACKGROUND
public static final jcontrol.graphics.Color COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED
public static final jcontrol.graphics.Color COLOR_COMPONENT_DARK_SHADOW
public static final jcontrol.graphics.Color COLOR_COMPONENT_FOREGROUND
public static final jcontrol.graphics.Color COLOR_COMPONENT_FOREGROUND_INACTIVE
public static final jcontrol.graphics.Color COLOR_COMPONENT_HIGHLIGHT_SHADOW
public static final jcontrol.graphics.Color COLOR_COMPONENT_LIGHT_SHADOW
public static final jcontrol.graphics.Color COLOR_COMPONENT_LIST_BACKGROUND
public static final jcontrol.graphics.Color COLOR_COMPONENT_NORMAL_SHADOW
public static final jcontrol.graphics.Color COLOR_COMPONENT_SELECTION_TEXT
public static final jcontrol.graphics.Color COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND
public static final jcontrol.graphics.Color COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE
public static final jcontrol.graphics.Color COLOR_COMPONENT_SELECTION_TEXT_INACTIVE
public jcontrol.graphics.Color foregroundColor
public IFrame frame
public int height
setBounds(int, int, int, int)
public IContainer parent
public int state
public jcontrol.graphics.Color transparentColor
public int width
setBounds(int, int, int, int)
public int x
setBounds(int, int, int, int)
public int y
setBounds(int, int, int, int)
Constructor Detail |
---|
public Component()
Method Detail |
---|
public IFrame getFrame()
public boolean isEnabled()
public boolean isVisible()
Returns true
if this component is set visible,
and false
otherwise.
public void paint(jcontrol.graphics.XGraphics g)
g
- the application's graphics object.public void repaint()
public void repaintAll()
public static void safeExec(java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. The thread calling this method
is blocked until the runnable has been completed.
This method should be used every time when the ui framework is modified from a thread
that is NOT the user interface thread. Please use this method only after the
method setVisible(true)
of the main frame has been called
(because this mthod is starting the user-interface thread).
When an application adds or removes components or when it changes the content of the main
frame, it is strongly recommended to use safeExec(). Otherwise, the ui framework
might behave unexpectedly.
Use the method safeExec() as shown by the following code snipped:
// The run method of any thread
public void run() {
...
// here, the content of the main frame should be changed
// call the safeExec method
Component.safeExec(new Runnable() {
public void run() {
// place your code here to be executed by the ui-thread
// example:
frame.setContent(new MyContent());
}
});
// here, the content of the frame has already been changed because
// this thread was blocked until the runnable has been executed
...
}
runnable
- the runnable to executeunsafeExec(Runnable)
public void setBackgroundColor(jcontrol.graphics.Color background)
background
- the background color to setpublic void setBounds(int x, int y, int width, int height)
x
- The x-coordinate of the upper left cornery
- The y-coordinate of the upper left cornerwidth
- The width of this componentheight
- The height of this componentpublic void setDirty(int state, boolean onoff)
state
-parameter. All parent containers are set/unset dirty.
state
- the state to setonoff
- set or unset the statepublic void setEnabled(boolean enabled)
enabled
- the enabled state.public void setFont(jcontrol.io.Resource font)
font
- the new font.public void setForegroundColor(jcontrol.graphics.Color foreground)
foreground
- the foreground color to setpublic void setRedraw(boolean onoff)
onoff
- true - drawing on (default), false - drawing offpublic void setTransparentColor(jcontrol.graphics.Color transparentColor)
transparentColor
- the transparent color to setpublic void setVisible(boolean visible)
visible
- the visible state to set.public static void unsafeExec(java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. The caller of this method continues
to run in parallel, and is not notified when the
runnable has been completed.
This method should be used every time when the ui framework is modified from a thread
that is NOT the user interface thread. Please use this method only after the
method setVisible(true)
of the main frame has been called
(because this mthod is starting the user-interface thread).
When an application adds or removes components or when it changes the content of the main
frame, it is strongly recommended to use safeExec(). Otherwise, the ui framework
might behave unexpectedly.
Use the method unsafeExec() as shown by the following code snipped:
// The run method of any thread
public void run() {
...
// here, the content of the main frame should be changed
// call the unsafeExec method
Component.unsafeExec(new Runnable() {
public void run() {
// place your code here to be executed by the ui-thread
// example:
frame.setContent(new MyContent());
}
});
// here, the content of the frame has NOT been changed yet and
// this thread continues to run BEFORE the runnable has been executed
...
}
runnable
- the runnable to executesafeExec(Runnable)
public void update(jcontrol.graphics.XGraphics g)
g
- the application's graphics object.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |