wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JDialog? - parser status window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog? - parser status window" Watch "JDialog? - parser status window" New topic

JDialog? - parser status window

Matt Zollinhofer
Ranch Hand

Joined: Jul 09, 2004
Posts: 33
Ok folks, I'm trying create a window that shows the list of links as it grows from a running web crawler/parser.

Now, I don't want anything else to happen in my program until this is finished and the user clicks OK (after seeing complete list of links). I think the appropriate way to do this is to have the driver of my program create this window, which I think should be a modal jdialog. The jdialog should then tell the parser to begin and the parser will send back linkAdded() calls to the jdialog.

I'm not positive if this is even the right way to go about the flow of control, so other thoughts about that are welcome. Assuming my thoughts are reasonable, let me tell you my problem. I have the JDialog class written. So, I instantiate it in my driver, then call show() on it. Thought that if added the code I want to run in the show method after calling super.show() it would work, but because I want this to be modal, it seems to block after that. So, I guess my question is, how do I execute code after the show() is called when it is a modal dialog?

[ August 03, 2004: Message edited by: Matt Zollinhofer ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Here's one way to approach this using a SwingWorker. Requires SwingWorker.java.
Matt Zollinhofer
Ranch Hand

Joined: Jul 09, 2004
Posts: 33
Thanks for your help Craig, after taking a fews days off and looking at it again. I realized I was just overthinking it. I ended up just making it a JFrame, and making it implement Runnable. That way in my control program, I instantiate it, then tell it to run which the initiates the calculations/updates that it needs to. I also made my control program an actionlistener and passed it to the frame, so that it will react when I push the OK button.

Thanks again,
I agree. Here's the link: http://aspose.com/file-tools
subject: JDialog? - parser status window
Similar Threads
SWING Multiple GUI
Finding X Y location of button
Correct behaviour when launching a new window and getting rid of the first window
Modal Dilag box
JDialog questions