I have multiple tabs serve1, server2, server3 which contain the same UI fields. Once a submit is pressed I wanted to validate the fields of all 3 tabs. What is the best way to do this, I can iterate over all the tabs but how to retrieve values of fields inside the tab.
//snippet - tabs creation
//IP address field
javafx.scene.control.TextField ipField = new javafx.scene.control.TextField();
Tab server1 = new Tab("server1");
server1.setContent(field);
Tab server2 = new Tab("server2");
server2.setContent(field);
Tab server3 = new Tab("server3");
server3.setContent(field);
//onSubmit
submitButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
//validate IP address of all three servers here
//how can I access the field here by iterating all three tabs?
}
});
Note: Not using fxml way of building UI
Thanks in advance