• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel component updating

 
Jack Conger
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm making a "to-do" type class, which is basically a JPanel that displays an ArrayList of ToDos (A custom class with a JCheckBox and a JTextField). The JPanel also has a box with an Add and Remove button, and is contained in a JScrollPane.

For some reason, when you click any of the buttons, the JPanel doesn't correctly redisplay until you de-focus it, and I don't know how to do that...
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you getting any exception? Can you elaborate on what you mean when you say "panel doesnt correctly redisplay"? Does it mean it doesnt show the checkbox toggled state?

It would be helpful if you posted the code.
 
Jack Conger
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't redisplay as in the box repaints, but the JPanel doesn't allocate the correct space.

Code? Love to:
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Hector von Doodle
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jack Conger:
Hi,

I'm making a "to-do" type class, which is basically a JPanel that displays an ArrayList of ToDos (A custom class with a JCheckBox and a JTextField). The JPanel also has a box with an Add and Remove button, and is contained in a JScrollPane.

For some reason, when you click any of the buttons, the JPanel doesn't correctly redisplay until you de-focus it, and I don't know how to do that...


Is the code that processes the button click running in the AWT Thread?
 
Jack Conger
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dunn: Thanks! It worked great!

von Doodle: Yes, but it's not an issue.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hate global time differences. Michael beat me to it
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!