This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

JWindow showing up as a white box

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?
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.
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!