org.gnome.gtk

Class Fixed


public class Fixed
extends Container

Fixed is a Container Widget that allows you to position other widgets on it at fixed coordinates. These could include Buttons and Labels as well as more complex composite widgets like Boxes.

You should not use Fixed for any non-trivial purpose. While you might think at first that it would simplify your application, the reality is that Fixed is almost always the wrong Container choice. Because GTK is the widget toolkit used to power the user interfaces of GNOME applications, the appearance of Widgets is very dynamic. Different window managers and theme engines can radically change the size and appearance of Widgets to suit varying accessibility and usability requirements; different fonts available to your users will cause Labels to be sized differently than you'd expect, and of course translation completely throws predictability right out the window. Since the Fixed Container does not adapt to the size requests of the Widgets with in it, the frequent result is truncated text, overlapping Widgets, and other visual bugs.

The Fixed widget can't be properly mirrored in right-to-left languages such as Hebrew and Arabic. A Fixed widget with a right-to-left font will render your application unusable.

Adding or removing any GUI elements from this Fixed requires you to reposition all the other Widgets within it. As you can imagine, this will end up a long-term maintenance headache for your application.

If any of those are a concern for your application, then you should be using a different Container, either combinations of VBox and HBox, or perhaps Table. You have been warned!

Authors:
Srichand Pendyala
Andrew Cowie
Since:
4.0.1
See Also:
Layout, DrawingArea

Nested Class Summary

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

Widget.ENTER_NOTIFY_EVENT, Widget.FOCUS_OUT_EVENT

Constructor Summary

Fixed()
Create a new Fixed Widget.

Method Summary

void
moveWidget(Widget widget, int x, int y)
Move a Widget that has already been added to this Fixed to a new location.
void
putWidget(Widget widget, int x, int y)
Place a Widget into the Fixed Container at a specified location.

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

Fixed

public Fixed()
Create a new Fixed Widget.
Since:
4.0.1

Method Details

moveWidget

public void moveWidget(Widget widget,
                       int x,
                       int y)
Move a Widget that has already been added to this Fixed to a new location.

Calling moveWidget() will cause GTK to inherently redraw the entire Fixed surface. If you have many Widgets in a Fixed, this can lead to flickering. Consider using Layout or DrawingArea instead.

The x and y co-ordinates are measured in pixels from the top left corner of the Fixed.

Parameters:
widget - the Widget that will be moved.
x - the horizontal position to move widget to.
y - the vertical position to move widget to.
Since:
4.0.1

putWidget

public void putWidget(Widget widget,
                      int x,
                      int y)
Place a Widget into the Fixed Container at a specified location.

It is up to you to ensure that the placing of the new Widget will not overlap any existing Widgets. If this is starting to be a burden, it's a good sign you're using the wrong Container!

The x and y co-ordinates are measured in pixels from the top left corner of the Fixed.

Parameters:
widget - the Widget to be placed in the Fixed.
x - horizontal position for the Widget being added
y - vertical position for the Widget being added
Since:
4.0.1