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

public static class AlertDialog.Builder<B extends AlertDialog.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
4.10
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public AlertDialog build()
      Finish building the AlertDialog object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to AlertDialog.
      Overrides:
      build in class GObject.Builder<B extends AlertDialog.Builder<B>>
      Returns:
      a new instance of AlertDialog with the properties that were set in the Builder object.
    • setButtons

      public B setButtons(String[] buttons)

      Labels for buttons to show in the alert.

      The labels should be translated and may contain a _ character to indicate the mnemonic character.

      If this property is not set, then a 'Close' button is automatically created.

      Parameters:
      buttons - the value for the buttons property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setCancelButton

      public B setCancelButton(int cancelButton)

      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 the buttons array, then an error is returned.

      If buttons is NULL, then the automatically created 'Close' button is treated as both cancel and default button, so 0 is returned.

      Parameters:
      cancelButton - the value for the cancel-button property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setDefaultButton

      public B setDefaultButton(int defaultButton)

      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 the buttons array, then nothing happens.

      If buttons is NULL, then the automatically created 'Close' button is treated as both cancel and default button, so 0 is returned.

      Parameters:
      defaultButton - the value for the default-button property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setDetail

      public B setDetail(String detail)
      The detail text for the alert.
      Parameters:
      detail - the value for the detail property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setMessage

      public B setMessage(String message)
      The message for the alert.
      Parameters:
      message - the value for the message property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setModal

      public B setModal(boolean modal)
      Whether the alert is modal.
      Parameters:
      modal - the value for the modal property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10