java-gnome version 4.0.19

org.gnome.gtk
Class Statusbar

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
                  extended by org.gnome.gtk.Widget
                      extended by org.gnome.gtk.Container
                          extended by org.gnome.gtk.Box
                              extended by org.gnome.gtk.HBox
                                  extended by org.gnome.gtk.Statusbar

public class Statusbar
extends HBox

The space at the bottom of an application Window where status messages are displayed.

A Statusbar should generally be present at the bottom of a GNOME application's main Window by being the first Widget to be packed with respect to the end of the VBox used to vertically layout such a Window:

 status = new Statusbar();
 vbox.packEnd(status, false, false, 0);
 window.add(vbox);
 
in fact, this is so much a convention that a Statusbar should be present regardless of whether or not you plan to have messages to display. Make sure you pack it into the top level VBox with expand and fill set to false as shown. Statusbars somewhat by definition should stay narrow; they shouldn't grow thicker if the user resizes vertically.

The text in the Statusbar is set with setMessage(). Most applications leave the Statusbar empty as a default state, but if you wish to inform the user of things being in a normal state, you can certainly do so:

 status.setMessage("Ready");
 
or similar words appropriate to your program.

Statusbars are excellent for providing hints to the user about what the user can do next (see Inkscape as a terrific example), or to update the user with what the application is up to when processing. Keep in mind, however, that this is considered only an assistance; people don't necessarily look to the Statusbar when wondering what is going on (and further, many applications allow the user to turn the Statusbar off entirely). If you need to provide urgent information to the user then use a Dialog.

As a Box subclass, you can pack other Widgets into the Statusbar. This is a great place for a ProgressBar if you have a long running worker thread that needs to report its percentage completion. Widgets so added will be packed after the Label that is (obviously) internally present to display the status messages. If it is a small Window you may want to constrain the size of the ProgressBar lest it blot out the message:

 status = new Statusbar();
 bar = new ProgressBar();
 bar.setSizeRequest(30, -1);
 status.packEnd(bar, false, false, 0);
 
then later:
 status.setMessage("Sending all your files to the CIA...");
 bar.setFraction(0.35);
 

A visible Statusbar usually drawn with a grip in the bottom right corner which most users will recognized as a stylized visual indication that the Window can be resized. If necessary, it can be suppressed by calling setHasResizeGrip(false).

The underlying API in GtkStatusbar is ridiculously complicated for absolutely no good reason. We have therefore compressed its hideous stack-based mechanism into the simple single-message interface presented here.

Since:
4.0.6
Author:
Andrew Cowie

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
 
Nested classes/interfaces inherited from class org.gnome.gtk.Object
Object.Destroy
 
Constructor Summary
Statusbar()
          Construct a new Statusbar.
 
Method Summary
 void setHasResizeGrip(boolean setting)
          Set whether or not the Statusbar has a visual marking at its right hand side indicating whether or not it can be resized and acting as a convenient target to click on.
 void setMessage(String text)
          Set the message showing in the Statusbar.
 
Methods inherited from class org.gnome.gtk.Box
getSpacing, packEnd, packStart, reorderChild, setSpacing
 
Methods inherited from class org.gnome.gtk.Container
add, getChildren, remove, setBorderWidth
 
Methods inherited from class org.gnome.gtk.Widget
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
 
Methods inherited from class org.gnome.gtk.Object
connect, destroy
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Statusbar

public Statusbar()
Construct a new Statusbar. The initial message is empty (you don't need to explicitly set it to be so).

Since:
4.0.6
Method Detail

setHasResizeGrip

public void setHasResizeGrip(boolean setting)
Set whether or not the Statusbar has a visual marking at its right hand side indicating whether or not it can be resized and acting as a convenient target to click on.

As the default for this is true, you only need to call this if you want to suppress the resize handle from being drawn. Note that this is just a visual cue; the actual resize behaviour is governed by the window manager in concert with the Window's resizable property. See setResizable().

As a very rough guide, main application Windows really ought to have the resize grip; fancy custom popups filling some transient purpose that just happen to have a Statusbar can do without them.

Since:
4.0.6

setMessage

public void setMessage(String text)
Set the message showing in the Statusbar. You can call this frequently with whatever indication you wish to display to the user; the last message will be discarded.

If you want to clear the message, simply pass the empty string, "".

Since:
4.0.6


java-gnome