File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Freezing the Non Modal Window

 
Justin Russo
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out javax.swing.SwingWorker
 
Justin Russo
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the swingworker but how do i freeze only the current window. not the entire app.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Justin Russo
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic