public abstract class Container extends Widget
Containers fall into two major categories. They are either:
Button(adding the push button aspect to a Widget) and
Window(the top level Widget which adds window decorations via the window manager); or
Fixedlayout tool, the ubiquitous
Boxsubclasses like VBox and HBox, and the more advanced packing mechanisms like
Containers intermediate in GTK's box packing process. Each Container aggregates the requests from its children during the size request phase, and then later, as actual screen real estate is granted to it, the Container must then divide that space amongst each of its children in the size allocation phase.
For more information about how this works, and on how you can influence it
if necessary, see Widget's
setSizeRequest(). To get an indication of how much space has been (will
be) requested by a child, a Container will also find the
getRequisition() method useful. The Actual
size granted is available at
once the box packing cycle has been carried out.
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
|Modifier and Type||Method and Description|
Add a child Widget to this Container.
Get the Widgets that are children of this Container, i.e. the Widgets previously added to the Container.
Remove a Widget from this Container.
Set the amount of padding to put around the outside of this Container, in pixels.
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public void add(Widget child)
public Widget getChildren()
Button button, child; Widget children; box.add(button); children = box.getChildren(); child = (Button) children;In other situations (wondering just what aggregation of Widgets makes up something that was handed to you by Glade, perhaps),
instanceofis your friend. Indeed sometimes it's the only way; the box packing composition of GTK elements means that even things you might take for granted as elementary (Button) are in fact more complex (an HBox of an Image and a Label) - and often the only way to find this out is to walk the Widget hierarchy.
public void remove(Widget child)
In native GTK, this often results in the destruction of the Widget. In java-gnome, that will only 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!
public void setBorderWidth(int width)
width- Although anything under 65535 is a valid value, anyone who thinks they need a border width of sixty thousand pixels is invited to get their head examined.