I am working with eclipse jee photon and scenebuilder.
What I am trying to do: I have a choicebox with two labels: ObservableList labelList = FXCollections.observableArrayList("examlpe01", "example02");
If example01 is chosen, the checkbox should be visible but disabled. If example02 is chosed the checkbox should be visible and it should be possible to check it.
Here is my code:
public class newUser{
ObservableList <String> labelList = FXCollections.observableArrayList("example01", "example02");
@FXML
private TextField name;
@FXML
private TextField lastName;
@FXML
private Button saveUser;
@FXML
private CheckBox adminRights;
@FXML
private TextField emailAdress;
@FXML
private TextField password;
@FXML
private Button userSpeichern;
@FXML
private MenuButton userDropDown;
@FXML
private MenuItem adminpage;
@FXML
private MenuItem example01;
@FXML
private MenuItem example02;
@FXML
private MenuItem logout;
@FXML
private ChoiceBox label;
@FXML
private void initialize() {
label.setItems(labelList);
label.setValue("mm");
}
@FXML
void logout(ActionEvent event) throws IOException {
Parent Login = FXMLLoader.load(getClass().getClassLoader().getResource("fxml/Login.fxml"));
Scene Login_scene = new Scene(Login);
Stage app_stage = (Stage) userDropDown.getScene().getWindow();
app_stage.setScene(Login_scene);
app_stage.show();
}
DbHelper db = new DbHelper();
private void showCheckbox() {
if (label.equals("example02")) {
}
}
@FXML
void saveUserData(ActionEvent event) {
}