Home » JavaFX CheckBox

JavaFX CheckBox

by Online Tutorials Library

JavaFX CheckBox

The Check Box is used to provide more than one choices to the user. It can be used in a scenario where the user is prompted to select more than one option or the user wants to select multiple options.

It is different from the radiobutton in the sense that, we can select more than one checkboxes in a scenerio.

Instantiate javafx.scene.control.CheckBox class to implement CheckBox.

Use the following line in the code to create a blank CheckBox.

Use the following line to attach a label with the checkbox.

We can change the CheckBox Label at any time by calling an instance method setText(“text”). We can make it selected by calling setSelected(“true”)

The following code implements CheckBox into our application.

Output:

JavaFX CheckBox

Next TopicJavaFX TextField

You may also like