This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes How do i block user inputs till swing worker terminates ? 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 "How do i block user inputs till swing worker terminates ?" Watch "How do i block user inputs till swing worker terminates ?" New topic
Author

How do i block user inputs till swing worker terminates ?

raj varma
Greenhorn

Joined: Jan 05, 2003
Posts: 28
How do i use JProgress bar to show some work is going on till swing worker thread finishes, so that i can bock further users inputs ?
Please Help
Howard Zhao
Greenhorn

Joined: May 06, 2002
Posts: 27
Hi
Suppose curFrame is your current working JFrame and myComp is the component whcih has focus.
Right before your worker starts, do
curFrame.getGlassPane().setVisible(true); //block mouse input
curFrame.getGlassPane().requestFocus(); //block keyboard input
After the worker finishes, do
curFrame.getGlassPane().setVisible(false);
myComp.requestFocus(); //set focus back to get keyboard input.
Howard
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i block user inputs till swing worker terminates ?