- java.lang.Object
-
- javafx.scene.control.ButtonType
-
public final class ButtonType extends Object
The ButtonType class is used as part of the JavaFXDialog
API (more specifically, theDialogPane
API) to specify which buttons should be shown to users in the dialogs. Refer to theDialogPane
class javadoc for more information on how to use this class.- Since:
- JavaFX 8u40
- See Also:
Alert
,Dialog
,DialogPane
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ButtonType(String text)
Creates a ButtonType instance with the given text, and the ButtonData set asButtonBar.ButtonData.OTHER
.ButtonType(String text, ButtonBar.ButtonData buttonData)
Creates a ButtonType instance with the given text, and the ButtonData set as specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ButtonBar.ButtonData
getButtonData()
Returns the ButtonData specified for this ButtonType in the constructor.String
getText()
Returns the text specified for this ButtonType in the constructor.String
toString()
Returns a string representation of the object.
-
-
-
Field Detail
-
APPLY
public static final ButtonType APPLY
A pre-definedButtonType
that displays "Apply" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.APPLY
.
-
OK
public static final ButtonType OK
A pre-definedButtonType
that displays "OK" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.OK_DONE
.
-
CANCEL
public static final ButtonType CANCEL
A pre-definedButtonType
that displays "Cancel" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.CANCEL_CLOSE
.
-
CLOSE
public static final ButtonType CLOSE
A pre-definedButtonType
that displays "Close" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.CANCEL_CLOSE
.
-
YES
public static final ButtonType YES
A pre-definedButtonType
that displays "Yes" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.YES
.
-
NO
public static final ButtonType NO
A pre-definedButtonType
that displays "No" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.NO
.
-
FINISH
public static final ButtonType FINISH
A pre-definedButtonType
that displays "Finish" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.FINISH
.
-
NEXT
public static final ButtonType NEXT
A pre-definedButtonType
that displays "Next" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.NEXT_FORWARD
.
-
PREVIOUS
public static final ButtonType PREVIOUS
A pre-definedButtonType
that displays "Previous" and has aButtonBar.ButtonData
ofButtonBar.ButtonData.BACK_PREVIOUS
.
-
-
Constructor Detail
-
ButtonType
public ButtonType(String text)
Creates a ButtonType instance with the given text, and the ButtonData set asButtonBar.ButtonData.OTHER
.- Parameters:
text
- The string to display in the text property of controls such asButton
.
-
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 asButton
.buttonData
- The type of button that should be created from this ButtonType.
-
-
Method Detail
-
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
-
toString
public String toString()
Returns a string representation of the object. In general, thetoString
method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.The
toString
method for classObject
returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:getClass().getName() + '@' + Integer.toHexString(hashCode())
-
-