Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we lock desktop.........Urgent

 
narayana murthy pedapudi
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
my application is a MDI application, i have a menu and many menuitems.
for different menuitems i have different frames, when i click on one menu item i don't want user to do some other click until the JFrame is closed,
can anyone please help in this regard,
it is urgent for me.
narayana
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by narayana murthy pedapudi:
hi,
my application is a MDI application, i have a menu and many menuitems.
for different menuitems i have different frames, when i click on one menu item i don't want user to do some other click until the JFrame is closed,
can anyone please help in this regard,
it is urgent for me.
narayana

I have dealt with this kind of problem before, although it seemed like a dirty solution. Here it is anyway:
When ever a menu listener receives an event (mouse up, etc.) it sets a state variable that is accessible to all of the listeners in your application (its a Singleton, say). Your listeners all check this state and if an event is being handled, ignore incoming events. Upon completion of servicing an event, the original unsets the flag. Careful use of the Singleton should take care of thread race conditions.
The user should be free to "click" in other applications on the desktop that are not part of your application.
I'd be interested to hear if you think this would help (or has terrible problems)
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Simplest way is to disable all the MenuItems before showing the Frame. And enable all of them upon disposing the Internal Frame.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic