I am using a for loop to create 9 JTextFields and this is working fine. My problem is, I want to check of all the these JTextField is empty or not' at one time. I know there is a method like:
if (textbox.getText().trim().equals(""))
to check if the JTextField is empty or not, But I am not sure if it is suitable for the method that I am using for JTextField. Below is my for loop:
for (int index = 1; index <=9; index++)
{
JTextField field = new JTextField(3);
field.setPreferredSize(new Dimension(150, 50));
field.setHorizontalAlignment(JTextField.CENTER);
field.setEditable(false);
second.add(field);
second.add(Box.createHorizontalStrut(10));
second.add(Box.createVerticalStrut(10));
}