Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help getting frame to repaint...  RSS feed

 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.isy.vcu.edu/~cstewart/info350/FinalProject.html
Start game -> place bet -> get JOptionPane showing you to follow a card
As soon as you press ok, I want the container to repaint so it gets rid of that gray area covering the cards. I've tried repainting/validating the layout manager, container, and jframe. Nothing has worked so far. Here is a snip of the code from that area:
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody? I've got to present my project on Tues.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you doing this inside the event thread (i.e. is this code inside an event handler method or called from an event handler method.) If so, Thread.sleep() is being called on the event loop, which controls event handling and repainting. You should put the two second delay at the beginning of your new thread's run() method, so it will be in another thread, and not the event thread.
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is in my main execution. Let me try putting it into the movement thread quick...
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked perfectly. Dude, I can't thank you enough. I've helped me out many times. Thanks again!!! This project should easily get me an A in the class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!