java-gnome version 4.0.19

org.gnome.gtk
Class ResponseType

Object
  extended by org.freedesktop.bindings.Constant
      extended by org.gnome.gtk.ResponseType

public class ResponseType
extends org.freedesktop.bindings.Constant

Predefined responses for a Dialog. Each ResponseType is usually associated with a preconfigured action Button in the Dialog, but can also come from other Widgets or user actions, such as closing the Window.

If one of these responses constants fits your needs, it is recommended that you make use of it. This is partly for code clarity but mostly because there are a number of special behaviours within GTK which presume you're using the correct predefined constants. This is especially the case in FileChooserDialog.

If your needs require it, however, you can define your own responses codes by extending this class. For example:

 public class PowerResponseType extend ResponseType
 {
     protected PowerResponseType(String nickname) {
         super(nickname);
     }
     
     public static final PowerResponseType SQUARED = new PowerResponseType("SQUARED");
     
     public static final PowerResponseType CUBED = new PowerResponseType("CUBED");
     
     public static final PowerResponseType FOURTH = new PowerResponseType("FOURTH");
 }
 

Since:
4.0.5
Author:
Vreixo Formoso, Andrew Cowie

Field Summary
static ResponseType APPLY
          Associated with a Button whose action is to accept the changes made by the user, but without closing the Dialog.
static ResponseType CANCEL
          Usually associated with a Button whose action is closing the Dialog, discarding any changes made on it by the user, or cancelling an action, either being executed or just before executing it.
static ResponseType CLOSE
          Used in a Button whose action is to close the Dialog.
static ResponseType DELETE_EVENT
          Returned when the user close the Dialog window, for example, by clicking the [x] Button or press Alt+F4 key.
static ResponseType HELP
          This response is associated with a help Button, whose Action is to open a contextual help about the Dialog and the settings it allow to change.
static ResponseType NO
          Associated with "No" Buttons, used in Dialogs that ask some question to the user.
static ResponseType NONE
          This corresponds to the programmatic hiding of the Dialog using the hide() method.
static ResponseType OK
          This response is usually associated with a Button whose action involves closing the Dialog and accept the action proposed.
static ResponseType YES
          Associated with "Yes" Buttons, used in Dialogs that ask some question to the user.
 
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

APPLY

public static final ResponseType APPLY
Associated with a Button whose action is to accept the changes made by the user, but without closing the Dialog.


CANCEL

public static final ResponseType CANCEL
Usually associated with a Button whose action is closing the Dialog, discarding any changes made on it by the user, or cancelling an action, either being executed or just before executing it.

This Button is usually disposed at the left of the Ok Button.


CLOSE

public static final ResponseType CLOSE
Used in a Button whose action is to close the Dialog.

Provide this kind of Buttons only on informative Dialogs, where the user cannot do any change, or in Dialogs where the changes can be easily reverted later (such as some preferences Dialogs). If the changes the Dialog allow have a great impact of the application, or it starts some action, it is better to provide OK and CANCEL Buttons.


DELETE_EVENT

public static final ResponseType DELETE_EVENT
Returned when the user close the Dialog window, for example, by clicking the [x] Button or press Alt+F4 key.


HELP

public static final ResponseType HELP
This response is associated with a help Button, whose Action is to open a contextual help about the Dialog and the settings it allow to change.


NO

public static final ResponseType NO
Associated with "No" Buttons, used in Dialogs that ask some question to the user.


NONE

public static final ResponseType NONE
This corresponds to the programmatic hiding of the Dialog using the hide() method.


OK

public static final ResponseType OK
This response is usually associated with a Button whose action involves closing the Dialog and accept the action proposed.

Typical usages of this response are: close an informative Dialog, accept changes made by user on a preferences Dialog, or start an action with the options shown in the Dialog.

In your Dialogs you should put this kind of Button in the Dialog right corner.


YES

public static final ResponseType YES
Associated with "Yes" Buttons, used in Dialogs that ask some question to the user.



java-gnome