org.gnome.gdk

## Class Gravity

- Object
- - org.freedesktop.bindings.Constant
  - - org.gnome.gdk.Gravity

-     public final class Gravity
      extends org.freedesktop.bindings.Constant

  Gravity determines the location of the reference point in root window co-ordinates and which point of the Window is positioned at the reference point. This impacts the co-ordinates used when moving Windows with `move()`. The gravity for a Window is set by `setGravity()`.

  It turns out the whole gravity concept is unreliable; luckily you don't really need it for much. And in any case, if you're trying to move the Window around; what you probably want is `setPosition()`.

  Since:
    4.0.4
  Author:
    Andrew Cowie

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Gravity` | `CENTER` Reference point is with respect to the center of the screen.
    `static Gravity` | `EAST` Co-ordinates are with respect to the center of the right-hand edge of the Window.
    `static Gravity` | `NORTH` Co-ordinates are with respect to the center of the top edge of the Window.
    `static Gravity` | `NORTH_EAST`
    `static Gravity` | `NORTH_WEST` Orientation to the top left corner of the screen and co-ordinates running right and down.
    `static Gravity` | `SOUTH` Co-ordinates are with respect to the center of the bottom edge of the Window.
    `static Gravity` | `SOUTH_EAST`
    `static Gravity` | `SOUTH_WEST`
    `static Gravity` | `STATIC` This is a weird one: it is in reference to the top-left corner of the Window itself (like `NORTH_WEST` but ignoring whatever decorations etc have been added outside by the window manager.
    `static Gravity` | `WEST` Co-ordinates are with respect to the center of the left-hand edge of the Window.

  - ### Method Summary

    - ### Methods inherited from class org.freedesktop.bindings.Constant

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### CENTER

          public static final Gravity CENTER

      Reference point is with respect to the center of the screen. If you're trying to center your Window on the screen this probably isn't what you want; see Window's `setPosition()` with an argument of `CENTER` or `CENTER_ALWAYS` instead.

    - #### EAST

          public static final Gravity EAST

      Co-ordinates are with respect to the center of the right-hand edge of the Window. This is rarely useful.

    - #### NORTH

          public static final Gravity NORTH

      Co-ordinates are with respect to the center of the top edge of the Window. This is rarely useful.

    - #### NORTH_EAST

          public static final Gravity NORTH_EAST

    - #### NORTH_WEST

          public static final Gravity NORTH_WEST

      Orientation to the top left corner of the screen and co-ordinates running right and down. This is the default gravity and matches what you'd normally expect `x`,`y` to mean on an X display: horizontal and vertical distance from the top-left corner.

    - #### SOUTH

          public static final Gravity SOUTH

      Co-ordinates are with respect to the center of the bottom edge of the Window. This is rarely useful.

    - #### SOUTH_EAST

          public static final Gravity SOUTH_EAST

    - #### SOUTH_WEST

          public static final Gravity SOUTH_WEST

    - #### STATIC

          public static final Gravity STATIC

      This is a weird one: it is in reference to the top-left corner of the Window itself (like `NORTH_WEST` but ignoring whatever decorations etc have been added outside by the window manager. At first this would seem brilliantly useful, but since it ignores window decorations, moving to the co-ordinates returned by `getPosition()` will actually cause the Window to move slightly on the screen, rather than staying still as you might have expected. So even when you think you want this, you really want NORTH_WEST, which is why it's the default.

    - #### WEST

          public static final Gravity WEST

      Co-ordinates are with respect to the center of the left-hand edge of the Window. This is rarely useful.