org.gnome.gtk
Class Container
java.lang.Object
org.freedesktop.bindings.Proxy
public abstract class Container
A Widget that contains at least one, and maybe more, other Widgets.
Container is the base of the GTK box packing model; all layouts are
composed of Widgets that are packed into other Widgets.
Containers fall into two major categories. They are either:
- decorators
Button
Window
or- layout
Fixed
Box
Table
TODO Add a human understandable discussion about the basics of
size
requests and
size allocations.
void | add(Widget child) - Add a child Widget to this Container.
|
void | remove(Widget child) - Remove a Widget from this Container.
|
add
public void add(Widget child)
Add a child Widget to this Container. This works for all the various
Container types, of course, but most offer more specialized packing
methods that allow you to control the positioning of the Widget being
added with greater finesse.
remove
public void remove(Widget child)
Remove a Widget from this Container.
In native GTK, this often results in the destruction of the Widget.
In java-gnome, that will occur once the last Java reference goes out of
scope and a garbage collection run occurs. So you can, quite safely,
do:
box1.remove(button);
box2.add(button);
without worrying that that Button is going to evaporate out from
under you.
child
- A child Widget that is already in the Container,
right? If you try to remove a Widget that isn't, don't
complain when you get all sorts of errors!
|  java-gnome |