amount = new JTextField(40);
amount.setFont(new Font("Arial", Font.PLAIN, 20));
amount.setBounds(_width / 2 + 25, (_height / 5) * 2 - (_height / 5) / 4, 50, 50);
content.add(amount);
urlBox = new JTextField(40);
ArrayList<JTextField> urlBoxes = new ArrayList<JTextField>();
JButton generate = new JButton("Generate");
generate.setFont(new Font("Arial", Font.PLAIN, 20));
generate.setBounds(_width / 2 + 25 + 55, (_height / 5) * 2 - (_height / 5) / 4, 200, 50);
generate.setBackground(Color.gray);
generate.setForeground(Color.white);
generate.setFocusPainted(false);
generate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
urlBoxes.clear();
for(int i = 0; i < Integer.parseInt(amount.getText()); i++) {
urlBoxes.add(urlBox);
urlBoxes.get(i).setFont(new Font("arial", Font.PLAIN, 20));
}
for(int i = 1; i < Integer.parseInt(amount.getText()) + 1; i++) {
urlBoxes.get(i - 1).setBounds(20, 3 * _height / 10 + 55 * i, _width / 2, 50);
content.add(urlBoxes.get(i - 1));
urlBoxes.get(i - 1).setVisible(true);
System.out.println("Added at " + urlBoxes.get(i - 1).getBounds().y);
}
}
});
content.add(generate);
}
Accoring to the System.out.println("Added at " + urlBoxes.get(i - 1).getBounds().y);
I think they have been created and put in the right position but they are just not showing