In my project javafx, I have a ComboBox with several values. When my application starts, I do the following:
gui.course_P = new ComboBox<String>();
for (int i = 1; i < gui.columns.size(); i++) {
gui.course_P.getItems().add(gui.columns.get(i));
}
gui.createTestButtonPane.add(gui.course_P, 2, 1);
Where gui.columnsis a list of lines.
Meanwhile, in the application, this value can be changed. However, since I already add this comboBox to my GridPane and then to my scene when this value changes (gui.columns), the new value does not appear in comboBox. Since I already added the old gui.course. Is there a way to update createTestButtonPane with the new gui.course_P?
EDIT: What I'm trying to do is add a value in comboBox to the listener, and then add it again to gridPane:
String temp1 = course_name.getText();
gui.course_P = new ComboBox<String>();
gui.course_P.getItems().add(temp1);
comboBox, , combobox gridpane, comboBox. gui.course gridPane.
EDIT2. .
gui.course_P = new ComboBox<String>();
for (int i = 1; i < gui.columns.size(); i++) {
gui.course_P.getItems().add(gui.columns.get(i));
}
, , 1- .
gui.course_P = new ComboBox<>(gui.columns); for, , - , . ?