wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Focus problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Focus problem" Watch "Focus problem" New topic
Author

Focus problem

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
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
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
hello its urgent, just give me some suggestions...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

hello Ease Up, perhaps nobody has any suggestions at this time...


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Nov 23, 2008
Posts: 23
Maybe you try with keyboard accelerators.
Keyboard accelerators are a bit more universal then mnemonics and might solve the problem.
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
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

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Mar 28, 2006
Posts: 259
thanks alot...

it worked fine..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Focus problem
 
Similar Threads
Internal Frame Focus
Events from inner components.
How do I get my applet to get focus?
mnemonics are not getting focus for the menubar
JInternalFrame to get Focus