• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JWindow showing up as a white box

 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the code for a nice JWindow as follows



Now all of this works when I run it by itself like as follows



However when it is brought up along with my GUI and another JWindow it just shows up as a white box.

Any ideas as to why it does this?
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This part:



and the fact that you call it in the askForPos() method is probably the cause of the problem. Basically, you're blocking the Event Dispatch thread, thus preventing the Window from repainting (or in your cause, painting for the first time). Even if it did paint successfully, it wouldn't be able to process any user input.

Better would be to not block at all, but to instead move the code that eventually disposes the Window (I assume you also want to setVisible(false) on it as well) to the actionPerformed() event handling code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic