Class AlertDialog.Builder<B extends AlertDialog.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
AlertDialog
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theAlertDialog
object.setButtons
(String[] buttons) Labels for buttons to show in the alert.setCancelButton
(int cancelButton) This property determines what happens when the Escape key is pressed while the alert is shown.setDefaultButton
(int defaultButton) This property determines what happens when the Return key is pressed while the alert is shown.The detail text for the alert.setMessage
(String message) The message for the alert.setModal
(boolean modal) Whether the alert is modal.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theAlertDialog
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toAlertDialog
.- Overrides:
build
in classGObject.Builder<B extends AlertDialog.Builder<B>>
- Returns:
- a new instance of
AlertDialog
with the properties that were set in the Builder object.
-
setButtons
Labels for buttons to show in the alert.The labels should be translated and may contain a _ to indicate the mnemonic character.
If this property is not set, then a 'Close' button is automatically created.
- Parameters:
buttons
- the value for thebuttons
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCancelButton
This property determines what happens when the Escape key is pressed while the alert is shown.If this property holds the index of a button in
Gtk.AlertDialog:buttons
, then pressing Escape is treated as if that button was pressed. If it is -1 or not a valid index for thebuttons
array, then an error is returned.If
buttons
isNULL
, then the automatically created 'Close' button is treated as both cancel and default button, so 0 is returned.- Parameters:
cancelButton
- the value for thecancel-button
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setDefaultButton
This property determines what happens when the Return key is pressed while the alert is shown.If this property holds the index of a button in
Gtk.AlertDialog:buttons
, then pressing Return is treated as if that button was pressed. If it is -1 or not a valid index for thebuttons
array, then nothing happens.If
buttons
isNULL
, then the automatically created 'Close' button is treated as both cancel and default button, so 0 is returned.- Parameters:
defaultButton
- the value for thedefault-button
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setDetail
-
setMessage
-
setModal
Whether the alert is modal.- Parameters:
modal
- the value for themodal
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-