buoy.widget
Class ExplicitContainer
public class ExplicitContainer
ExplicitContainer is a WidgetContainer which allows the sizes and positions of its children to be
set explicitly.
In addition to the event types generated by all Widgets, ExplicitContainers generate the following
event types:
void | add(Widget widget, Rectangle bounds) - Add a Widget to this container.
|
Widget | getChild(int i) - Get the i'th child of this container.
|
Rectangle | getChildBounds(Widget widget) - Get the position of a child Widget within this container.
|
Rectangle | getChildBounds(int index) - Get the position of a child Widget within this container.
|
int | getChildCount() - Get the number of children in this container.
|
int | getChildIndex(Widget widget) - Get the index of a particular Widget.
|
Collection | getChildren() - Get a Collection containing all child Widgets of this container.
|
Dimension | getMinimumSize() - Get the smallest size at which this Widget can reasonably be drawn.
|
Dimension | getPreferredSize() - Get the preferred size at which this Widget will look best.
|
void | layoutChildren() - Layout the child Widgets.
|
void | remove(Widget widget) - Remove a child Widget from this container.
|
void | removeAll() - Remove all child Widgets from this container.
|
void | setChildBounds(Widget widget, Rectangle bounds) - Set the position of a child Widget within this container.
|
void | setChildBounds(int index, Rectangle bounds) - Set the position of a child Widget within this container.
|
addEventLink , dispatchEvent , getBackground , getBounds , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
ExplicitContainer
public ExplicitContainer()
Create a new ExplicitContainer.
add
public void add(Widget widget,
Rectangle bounds)
Add a Widget to this container.
widget
- the Widget to addbounds
- the location and size at which the Widget should appear
getChild
public Widget getChild(int i)
Get the i'th child of this container.
getChildBounds
public Rectangle getChildBounds(Widget widget)
Get the position of a child Widget within this container.
widget
- the Widget for which to get the location
- the bounding rectangle to be used for the Widget, or null if it is not a child
of this container
getChildBounds
public Rectangle getChildBounds(int index)
Get the position of a child Widget within this container.
index
- the index of the Widget for which to get the location
- the bounding rectangle to be used for the Widget
getChildIndex
public int getChildIndex(Widget widget)
Get the index of a particular Widget.
widget
- the Widget to locate
- the index of the Widget within this container
getChildren
public Collection getChildren()
Get a Collection containing all child Widgets of this container.
- getChildren in interface WidgetContainer
getMinimumSize
public Dimension getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out
its contents, it will attempt never to make this Widget smaller than its minimum size.
- getMinimumSize in interface Widget
getPreferredSize
public Dimension getPreferredSize()
Get the preferred size at which this Widget will look best. When a WidgetContainer lays out
its contents, it will attempt to make this Widget as close as possible to its preferred size.
- getPreferredSize in interface Widget
layoutChildren
public void layoutChildren()
Layout the child Widgets. This may be invoked whenever something has changed (the size of this
WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no
longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be
called in turn.
- layoutChildren in interface WidgetContainer
remove
public void remove(Widget widget)
Remove a child Widget from this container.
- remove in interface WidgetContainer
widget
- the Widget to remove
setChildBounds
public void setChildBounds(Widget widget,
Rectangle bounds)
Set the position of a child Widget within this container.
widget
- the Widget to movebounds
- the location and size at which the Widget should appear
setChildBounds
public void setChildBounds(int index,
Rectangle bounds)
Set the position of a child Widget within this container.
index
- the index of the Widget to movebounds
- the location and size at which the Widget should appear
Written by Peter Eastman.