public class ResponseType
extends org.freedesktop.bindings.Constant
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"); }
Modifier and Type | Field and Description |
---|---|
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.
|
public static final ResponseType APPLY
public static final ResponseType CANCEL
This Button is usually disposed at the left of the Ok Button.
public static final ResponseType CLOSE
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.
public static final ResponseType DELETE_EVENT
public static final ResponseType HELP
public static final ResponseType NO
public static final ResponseType NONE
hide()
method.public static final ResponseType OK
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.
public static final ResponseType YES