I've generated a UI in NetBeans that has 16 text fields positioned 4x4. To be able to iterate through them dynamically, I wanted to have those text fields in an array so their names would be something like field[0] - field[15], but i have not found a way to do so. The editor allows me only to assign a specific variable for each field, and it doesn't accept "[]" and returns an error message "The name of a component must be a valid Java Variable name.". I would prefer not to break the UI generator display by externally modifying the code, but if it's the only way to do this, then to hell with it. :) Thanks in advance!
There's no support for that sort of variable organization.
I have always approached it by adding something like this after the initComponents()
call:
fields = new JTextField[]{ textField1, textField2, ... };