# Class ButtonType

java.lang.Object
javafx.scene.control.ButtonType

public final class ButtonType extends Object
The ButtonType class is used as part of the JavaFX `Dialog` API (more specifically, the `DialogPane` API) to specify which buttons should be shown to users in the dialogs. Refer to the `DialogPane` class javadoc for more information on how to use this class.

Since:
  JavaFX 8u40
See Also:
  - `Alert`
  - `Dialog`
  - `DialogPane`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ButtonType`
  `APPLY`
  A pre-defined `ButtonType` that displays "Apply" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.APPLY`.
  `static final ButtonType`
  `CANCEL`
  A pre-defined `ButtonType` that displays "Cancel" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.CANCEL_CLOSE`.
  `static final ButtonType`
  `CLOSE`
  A pre-defined `ButtonType` that displays "Close" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.CANCEL_CLOSE`.
  `static final ButtonType`
  `FINISH`
  A pre-defined `ButtonType` that displays "Finish" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.FINISH`.
  `static final ButtonType`
  `NEXT`
  A pre-defined `ButtonType` that displays "Next" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.NEXT_FORWARD`.
  `static final ButtonType`
  `NO`
  A pre-defined `ButtonType` that displays "No" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.NO`.
  `static final ButtonType`
  `OK`
  A pre-defined `ButtonType` that displays "OK" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.OK_DONE`.
  `static final ButtonType`
  `PREVIOUS`
  A pre-defined `ButtonType` that displays "Previous" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.BACK_PREVIOUS`.
  `static final ButtonType`
  `YES`
  A pre-defined `ButtonType` that displays "Yes" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.YES`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ButtonType(String text)`
  Creates a ButtonType instance with the given text, and the ButtonData set as `ButtonBar.ButtonData.OTHER`.
  `ButtonType(String text, ButtonBar.ButtonData buttonData)`
  Creates a ButtonType instance with the given text, and the ButtonData set as specified.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final ButtonBar.ButtonData`
  `getButtonData()`
  Returns the ButtonData specified for this ButtonType in the constructor.
  `final String`
  `getText()`
  Returns the text specified for this ButtonType in the constructor.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### APPLY

    public static final ButtonType APPLY
    A pre-defined `ButtonType` that displays "Apply" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.APPLY`.

  - ### OK

    public static final ButtonType OK
    A pre-defined `ButtonType` that displays "OK" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.OK_DONE`.

  - ### CANCEL

    public static final ButtonType CANCEL
    A pre-defined `ButtonType` that displays "Cancel" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.CANCEL_CLOSE`.

  - ### CLOSE

    public static final ButtonType CLOSE
    A pre-defined `ButtonType` that displays "Close" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.CANCEL_CLOSE`.

  - ### YES

    public static final ButtonType YES
    A pre-defined `ButtonType` that displays "Yes" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.YES`.

  - ### NO

    public static final ButtonType NO
    A pre-defined `ButtonType` that displays "No" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.NO`.

  - ### FINISH

    public static final ButtonType FINISH
    A pre-defined `ButtonType` that displays "Finish" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.FINISH`.

  - ### NEXT

    public static final ButtonType NEXT
    A pre-defined `ButtonType` that displays "Next" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.NEXT_FORWARD`.

  - ### PREVIOUS

    public static final ButtonType PREVIOUS
    A pre-defined `ButtonType` that displays "Previous" and has a `ButtonBar.ButtonData` of `ButtonBar.ButtonData.BACK_PREVIOUS`.

- ## Constructor Details

  - ### ButtonType

    public ButtonType(String text)
    Creates a ButtonType instance with the given text, and the ButtonData set as `ButtonBar.ButtonData.OTHER`.
    Parameters:
      `text` - The string to display in the text property of controls such as `Button`.

  - ### ButtonType

    public ButtonType(String text, ButtonBar.ButtonData buttonData)
    Creates a ButtonType instance with the given text, and the ButtonData set as specified.
    Parameters:
      `text` - The string to display in the text property of controls such as `Button`.
      `buttonData` - The type of button that should be created from this ButtonType.

- ## Method Details

  - ### getButtonData

    public final ButtonBar.ButtonData getButtonData()
    Returns the ButtonData specified for this ButtonType in the constructor.
    Returns:
      the ButtonData specified for this ButtonType in the constructor

  - ### getText

    public final String getText()
    Returns the text specified for this ButtonType in the constructor.
    Returns:
      the text specified for this ButtonType in the constructor