The value
-property is for the currently selected item. You have to add the results to the items
-ObservableList instead:
List items = comboBox1.getItems(); // java.util.List by the way
items.add("item1"); // use the values from result set here instead
items.add("item2");
//...
If you want to show the prompt text, use this:
comboBox1.setPromptText("your prompt text");
Of course you don't create a ComboBox for each row in the ResultSet
but one for all rows:
//...
rs = preparedStatement.executeQuery();
ArrayList<String> subnames = new ArrayList<>();
// add all "subname" values to a List
while (rs.next()) {
subnames.add(rs.getString("subname"));
}
// create a ObservableList from the subnames List
ObservableList<String> options1 = FXCollections.observableArrayList(subnames);
comboBox1 = new ComboBox(options1);
//...