I have a multi scene JavaFX 2.2 application the code is on gitHub at this linkhttps://github.com/acaicedo/JFX-MultiScreen
When the application loads each scene has a controller and the scene to be displayed is loaded in a HasMap. When you go to Scene1 I have a ComboBox built with SceneBuilder so it has a FXML id cbNav and an onAction event. when I call this code from the ComboBox I get java.lang.IndexOutOfBoundsException but when I call the code below from a Button onAction event no error is produced
public void setData() {
cbNav.getItems().clear();
//cbNav.setValue(null);
cbNav.getItems().addAll("To 2","To 3","To 4");
cbNav.setPromptText("New Me:");
}
//Initializes the controller class.
@Override
public void initialize(URL url, ResourceBundle rb) {
setData();
}
@FXML
public void goWhere(ActionEvent e) throws Exception{
if(cbNav.getValue()=="To 2") {
setData();
myController.setScreen(ScreensFramework.screen2ID);
}
Button Code below
@FXML
private void goToScreen2(ActionEvent event){
setData();
myController.setScreen(ScreensFramework.screen2ID);
}
So the question is how do I RESET the ComboBox after the ComboBox is selected?