javafx.scene.control
Class ButtonType
- 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:
-
Field Summary
-
Constructor Summary
Constructors Constructor and 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 MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description ButtonBar.ButtonDatagetButtonData()Returns the ButtonData specified for this ButtonType in the constructor.StringgetText()Returns the text specified for this ButtonType in the constructor;StringtoString()
-
Field Detail
-
APPLY
public static final ButtonType APPLY
A pre-definedButtonTypethat displays "Apply" and has aButtonBar.ButtonDataofButtonBar.ButtonData.APPLY.
-
OK
public static final ButtonType OK
A pre-definedButtonTypethat displays "OK" and has aButtonBar.ButtonDataofButtonBar.ButtonData.OK_DONE.
-
CANCEL
public static final ButtonType CANCEL
A pre-definedButtonTypethat displays "Cancel" and has aButtonBar.ButtonDataofButtonBar.ButtonData.CANCEL_CLOSE.
-
CLOSE
public static final ButtonType CLOSE
A pre-definedButtonTypethat displays "Close" and has aButtonBar.ButtonDataofButtonBar.ButtonData.CANCEL_CLOSE.
-
YES
public static final ButtonType YES
A pre-definedButtonTypethat displays "Yes" and has aButtonBar.ButtonDataofButtonBar.ButtonData.YES.
-
NO
public static final ButtonType NO
A pre-definedButtonTypethat displays "No" and has aButtonBar.ButtonDataofButtonBar.ButtonData.NO.
-
FINISH
public static final ButtonType FINISH
A pre-definedButtonTypethat displays "Finish" and has aButtonBar.ButtonDataofButtonBar.ButtonData.FINISH.
-
NEXT
public static final ButtonType NEXT
A pre-definedButtonTypethat displays "Next" and has aButtonBar.ButtonDataofButtonBar.ButtonData.NEXT_FORWARD.
-
PREVIOUS
public static final ButtonType PREVIOUS
A pre-definedButtonTypethat displays "Previous" and has aButtonBar.ButtonDataofButtonBar.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.
-
-
Method Detail
-
getButtonData
public final ButtonBar.ButtonData getButtonData()
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;
-
toString
public String toString()
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.