Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Repaint in swing  RSS feed

 
Efrat Bar-Nahum
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a panel that contains a JTextField and a JButton.
When the button is pressed I'm adding a new text field to the panel.
After that I do panel.repaint();
My problem is that the text field is add, but the panel is not redraw itself.

How do I make it paint my new component?

Thanks a lot,
Efrat
 
Efrat Bar-Nahum
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found a solution - revalidate()!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!