jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes Freezing the Non Modal Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Freezing the Non Modal Window " Watch "Freezing the Non Modal Window " New topic
Author

Freezing the Non Modal Window

Justin Russo
Ranch Hand

Joined: Oct 21, 2007
Posts: 77
Hey Ranchers,

I am working on a project where in i have to make enhancements to a swing application.

Each window/frame in the application does a lot of work. Current design is if that window if busy, the entire application freezes and the user has to wait till the control comes back.

I need the freeze to be isolated to that window or some progress bar which is isolated to that window itself..

Is there some kind of api or something in Java Swings which can help me out of this problem.

Thanks


You Want it.. Get it.......the Right Way...<br /> <br />SCJP 5.0 SCWCD 5.0
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Swing is a single thread.

> Each window/frame in the application does a lot of work.

do the 'lot of work' is a separate thread, leaving the swing thread (EDT)
to paint and listen

[edit]
do the 'lot of work'
IN //<-----------------
a separate thread
[ March 31, 2008: Message edited by: Michael Dunn ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Check out javax.swing.SwingWorker


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Justin Russo
Ranch Hand

Joined: Oct 21, 2007
Posts: 77
I am using the swingworker but how do i freeze only the current window. not the entire app.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

That depends - how are you "freezing" the application now? Modal dialogs? Glasspane?

And are the frames the application uses actual JFrames or multiple JInternalFrames on a JDesktopPane inside one JFrame?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Justin Russo
Ranch Hand

Joined: Oct 21, 2007
Posts: 77
Right now it is freezing the entire application. How do we freeze only that window. I was planning to use SwingWorker but couldn't make it work.

Can we get some code snippet explaining the same..
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> How do we freeze only that window

if you mean how do you stop further user activity on that single window, have you tried
frame.setEnabled(false);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Freezing the Non Modal Window