org.gnome.gtk
Class Widget
java.lang.Object
org.freedesktop.bindings.Proxy
public abstract class Widget
The base class of all GTK Widgets. Graphical user interface toolkits have
long been built up from individual controls and presentation mechanisms
that are nested together. These elements are collectively called Widgets.
Quite a lot of Widgets contain other Widgets; those are called
Container
s.
connect
public void connect(Widget.ENTER_NOTIFY_EVENT handler)
Hook up a handler to receive "enter-notify-event" events on this
Widget.
connect
public void connect(Widget.FOCUS_OUT_EVENT handler)
Hook up a handler to receive "focus-out-event" events on this Widget
show
public void show()
Cause this Widget to be mapped to the screen. Flags a widget to be
displayed. Any widget that isn't shown will not appear on the screen.
There are a bunch of quirks you need to be aware of:
- You have to show the Containers containing a Widget, in addition
to the Widget itself, before it will appear on the display.
- When a toplevel Container is shown (ie, your
Window
),
it is immediately realized and mapped, and any Widgets within it that
are shown are then realized and mapped.
- You can't get information about the actual size that has been
allocated to a Widget until it gets mapped to the screen.
If you want to show all the widgets in a container, it's actually much
easier to just call
showAll()
on the container, rather than
calling show manually one each individual Widget you've added to it.
showAll
public void showAll()
Cause this Widget, and any Widgets it contains, to be mapped to the
screen. You typically call this on a
Window
after you've
finished all the work necessary to set it up.
Quite frequently you also want to cause a Window to appear on the
screen as well (ie, not be buried under a whole bunch of other
applications' Windows), so calling Window's
present()
is usually next.
Don't be surprised if this takes a few hundred milliseconds.
Realizing and mapping all the zillion elements that ultimately make up
a Window is one of the most resource intensive operations that GTK,
GDK, Pango, your X server, and your kernel have to churn through.
Sometimes, you just gotta wait.
|  java-gnome |