I am converting an app written using Swing to JavaFX. I need an array of TextField
s that I can manipulate collectively and as individual array members addressed by the array index. The following code works in Swing but I cannot find the equivalent in JavaFX, using TextField
instead of JTextField
. How can I achieve this in JavaFX?
private ArrayList<JTextField> fieldList= new ArrayList<JTextField>();
fieldList.add(fldCompletion);
fieldList.add(fldHrsToDate);
fieldList.add(fldHrsToComplete);
for(JTextField fl : fieldList) {
fl.setText("");
fl.setEnabled(true); //FX equivalent is setDisable(false)
}
fieldList.get(var).setText("");