Class CheckboxExampleController.java package jfoenix_example; import com.jfoenix.controls.JFXCheckBox; import java.net.URL; import j...
Class CheckboxExampleController.java
package jfoenix_example;
import com.jfoenix.controls.JFXCheckBox;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
/**
* FXML Controller class
*
* @author amir
*/
public class CheckboxExampleController implements Initializable {
@FXML
private JFXCheckBox c1;
@FXML
private JFXCheckBox c2;
@FXML
private JFXCheckBox c3;
@Override
public void initialize(URL url, ResourceBundle rb) {
//System.out.println(" Langage : "+ c1.getText());
//c1.setText("PHP + C#");
if (c1.isSelected()){
System.out.println(" Langage : "+ c1.getText());
}else{
System.out.println(" false");
}
}
}
CheckboxExample.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXCheckBox?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jfoenix_example.CheckboxExampleController">
<children>
<JFXCheckBox fx:id="c1" checkedColor="#ff06e6" layoutX="238.0" layoutY="108.0" selected="true" text="Python" unCheckedColor="#d8f501" />
<JFXCheckBox fx:id="c2" checkedColor="#f20a0a" layoutX="238.0" layoutY="165.0" text="Java" unCheckedColor="#00ff2f" />
<JFXCheckBox fx:id="c3" checkedColor="#09f835" layoutX="238.0" layoutY="229.0" text="HTML" unCheckedColor="#e40c0c" />
</children>
</AnchorPane>
COMMENTS