org.gnome.gtk

Class Widget

Known Direct Subclasses:
Container, Entry, Misc

public abstract class Widget
extends Object

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 Containers.
Author:
Andrew Cowie
Since:
4.0.0

Nested Class Summary

static interface
Widget.ENTER_NOTIFY_EVENT
Signal emitted when the mouse enters the Widget
static interface
Widget.FOCUS_OUT_EVENT
Signal emitted when the focus leaves this Widget.

Method Summary

void
connect(Widget.ENTER_NOTIFY_EVENT handler)
Hook up a handler to receive "enter-notify-event" events on this Widget.
void
connect(Widget.FOCUS_OUT_EVENT handler)
Hook up a handler to receive "focus-out-event" events on this Widget
Container
getParent()
void
show()
Cause this Widget to be mapped to the screen.
void
showAll()
Cause this Widget, and any Widgets it contains, to be mapped to the screen.

Methods inherited from class org.freedesktop.bindings.Proxy

toString

Method Details

connect

public void connect(Widget.ENTER_NOTIFY_EVENT handler)
Hook up a handler to receive "enter-notify-event" events on this Widget.
Since:
4.0.2

connect

public void connect(Widget.FOCUS_OUT_EVENT handler)
Hook up a handler to receive "focus-out-event" events on this Widget
Since:
4.0.2

getParent

public Container getParent()

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:

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.

Since:
4.0.0

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.

Since:
4.0.0