I have a JFrame. This JFrame contains a JButton. I click the JButton and 10 JTextFields are created.
the problem:
I cannot see them until "I force a repaint()" by resizing the window. Only then do I see the JTextFields created.
CODE:
JPanel points = new JPanel();
//Creating the JTextFields:
for (int i=0; i<10; i++) {
JTextField textField = new JTextField();
points.add(textField);
}
repaint();
this.repaint();
super.repaint();
points.repaint();
THANK YOU - after the for loop, I just called points.validate() and it worked...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…