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

Focus problem

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a build a gui application in swings....

The GUI has a toolbar with undo,redo,cut,copy,paste options.
The GUI also has a JInternalFrame with some graphic components say circle,rect. etc

I have also provided mnemonics to the GUI design...

Problem is, mnemonics are not working, when the focus is out of scope.

how to handle this problem?
need help regarding..

Note: JInternalFrame--->JScrollPane---Graph Components
 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello its urgent, just give me some suggestions...
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello Ease Up, perhaps nobody has any suggestions at this time...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Problem is, mnemonics are not working, when the focus is out of scope.

do you mean when some other app (e.g. notepad) is the active window?
 
Andre Uhres
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you try with keyboard accelerators.
Keyboard accelerators are a bit more universal then mnemonics and might solve the problem.
 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply...

the application has two JInternalFrames...the undo operations will be done in one JInternal Frame say iframe1.

the other JInternalFrame say iframe2 is only for display purpose.

if the focus is on iframe2, the undo chages in iframe1 is not reflected...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because they're internalFrames, you may have to get a bit lower in the event chain then keyBindings

here's a couple of ways to do that (in this e.g. using a button with mnemonic).
new problem is when jif1 has the focus, both mnemonic and the added code
trigger the button's actionEvent - so you may have to remove the mnemonic

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> you may have to get a bit lower in the event chain then keyBindings

on second thoughts, keyBindings of the desktop works better
(doesn't also trigger the mnemonic)

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot...

it worked fine..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic