org.gnome.gtk

Class Window


public class Window
extends Bin

The top level Widget that contains other Widgets. Typical examples are application windows, dialog boxes, and popup menus.
Authors:
Andrew Cowie
Srichand Pendyala
Since:
4.0.0

Nested Class Summary

static interface
Window.DELETE
This signal arises when a user tries to close a top level window.

Nested classes/interfaces inherited from class org.gnome.gtk.Widget

Widget.ENTER_NOTIFY_EVENT, Widget.FOCUS_OUT_EVENT

Constructor Summary

Window()
Create a new Window.
Window(WindowType type)
Create a new Window of the specified type.

Method Summary

void
connect(Window.DELETE handler)
void
setDecorated(boolean decorated)
By default, Windows are decorated with a title bar, minimize/maximize/close buttons, a border, resize handles, etc.
void
setDefaultSize(int width, int height)
Sets the default size of a Window.
void
setTitle(String title)
Sets the title that will be displayed in the Window's title bar.

Methods inherited from class org.gnome.gtk.Bin

getChild

Methods inherited from class org.gnome.gtk.Container

add, remove

Methods inherited from class org.gnome.gtk.Widget

connect, connect, getParent, show, showAll

Methods inherited from class org.freedesktop.bindings.Proxy

toString

Constructor Details

Window

public Window()
Create a new Window.

Window

public Window(WindowType type)
Create a new Window of the specified type. In general you don't need to use this; see the comments in WindowType; in particular, POPUP is not for dialog windows!
Since:
4.0.0

Method Details

connect

public void connect(Window.DELETE handler)

setDecorated

public void setDecorated(boolean decorated)
Since:
4.0.0

setDefaultSize

public void setDefaultSize(int width,
                           int height)
Sets the default size of a Window. If the Window's "natural" size (the size request resulting from the aggregate requests of all the Widgets contained in this Window) is larger than the default, the default will be ignored. The default size of a Window only affects the first time a Window is shown; if a Window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.

Depending on your needs, resize() could be more appropriate, especially if the Window is already realized . resize() changes the current size of the Window, rather than the size to be used on initial display which is what this method is for.

Incidentally, Windows can't be 0x0; the minimum size is 1x1.

Parameters:
width - The default minimum width you'd like to set. A value of 0 will be silently bumped to 1. A value of -1 will unset any previous default width setting.
height - Same.
Since:
4.0.1

setTitle

public void setTitle(String title)
Sets the title that will be displayed in the Window's title bar.

The title of a Window is an important usability factor. It should help the user distinguish this Window from others they may have open - and that gets tough when many, many applications are running. The key is to get the most relevant information is first. Examples of good titles are:

  • Invoice.odt
  • Invoice.odt - OpenOffice
  • andrew@procyon:~/src
  • Audio Configuration

This is important because the list of Windows titles the user is looking at may have been truncated with the result that you can't tell the difference between different Windows of the same application. For example, these are no good if you can only see the first 20 characters of the title:

  • OpenOffice 2.0.4 brought to you by the letter B! - Invoice.odt
  • OpenOffice 2.0.4 brought to you by the letter B! - LoveLetter.odt

Don't forget that Windows also have an icon, and that icon will show in the list too, so you don't even really need the application name - leaving more room for the details that help identify this Window uniquely.

Since:
4.0.0