This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do i block user inputs till swing worker terminates ?

 
raj varma
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic