File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JWindow showing up as a white box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JWindow showing up as a white box" Watch "JWindow showing up as a white box" New topic

JWindow showing up as a white box

Atrus Greyor
Ranch Hand

Joined: Mar 07, 2004
Posts: 110
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

Joined: May 15, 2001
Posts: 132
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.

Dave Taubler<br />Specializing in <a href="" target="_blank" rel="nofollow">Java and Web Development</a>
I agree. Here's the link:
subject: JWindow showing up as a white box
It's not a secret anymore!