|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Container
Container is a control that contains child controls.
Field Summary | |
static byte |
BORDER_LOWERED
used in the setBorderStyle method |
static byte |
BORDER_NONE
used in the setBorderStyle method |
static byte |
BORDER_RAISED
used in the setBorderStyle method |
static byte |
BORDER_SIMPLE
used in the setBorderStyle method |
protected Control |
children
The children of the container. |
protected int |
lastH
|
protected int |
lastW
|
protected int |
lastX
|
protected int |
lastY
|
protected Window |
parentWindow
|
protected Control |
tail
The tail of the children list. |
Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
Constructor Summary | |
Container()
Creates a container with the default colors. |
Method Summary | |
void |
add(Control control)
Adds a child control to this container. |
void |
add(Control control,
int x,
int y)
Add the control to this container and set its rect to be the given x,y and PREFERRED as width/height relative to the last control added |
void |
add(Control control,
int x,
int y,
Control relative)
Add the control to this container and set its rect to be the given x,y and PREFERRED as width/height relative to the given control |
void |
broadcastEvent(Event e)
posts a event to the children of this container and to all containers inside this containers; recursively. |
Control |
findChild(int x,
int y)
Returns the child located at the given x and y coordinates. |
Control[] |
getChildren()
return an array of Controls that are added to this Container. if theres no Controls, returns null. |
Rect |
getClientRect()
returns the client rect for this Container, in relative coords |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. |
void |
onPaint(Graphics g)
Draws the border (if any). |
protected void |
onStart()
Called when this container can be initialized |
void |
paintChildren(Graphics g,
int x,
int y,
int width,
int height)
Called by the system to draw the children of the container. |
void |
remove(Control control)
Removes a child control from the container. |
void |
setBorderStyle(byte border)
Sets the border for this container. |
void |
setEnabled(boolean enabled)
sets if this container and all childrens can or not accept events |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getPreferredHeight,
getPreferredWidth,
getRect,
getSize,
isDisplayed,
isEnabled,
isVisible,
onBoundsChanged,
onEvent,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
protected Control children
protected Control tail
public static final byte BORDER_NONE
public static final byte BORDER_LOWERED
public static final byte BORDER_RAISED
public static final byte BORDER_SIMPLE
protected Window parentWindow
protected int lastX
protected int lastY
protected int lastW
protected int lastH
Constructor Detail |
public Container()
MainWindow.getMainWindow().getClientRect()
.
If you're extending the Container class and adding controls in its constructor, you may come into problems if you don't set the bounds as the first thing. This is easy if you're just adding the controls to a MainWindow. But if you're adding to a TabPanel, for example, there is no way to know the TabPanel's size. The solution for this problem is to pass in the constructor of your Container class the Rect with the desired bounds, as demonstrated in the examples/ui/ContainerSwitch
Method Detail |
public void add(Control control, int x, int y)
public void add(Control control, int x, int y, Control relative)
public void add(Control control)
public void remove(Control control)
public Control findChild(int x, int y)
public Control[] getChildren()
public void setEnabled(boolean enabled)
public void broadcastEvent(Event e)
public void paintChildren(Graphics g, int x, int y, int width, int height)
public void setBorderStyle(byte border)
public Rect getClientRect()
protected void onColorsChanged(boolean colorsChanged)
public void onPaint(Graphics g)
super.onPaint(g);
, or the border will not be drawn.g
- the graphics object for drawingGraphics
protected void onStart()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |