Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Tab key not processed?  (Read 1727 times)
0 Members and 2 Guests are viewing this topic.
Offline appel

JGO Wizard
****

Posts: 1477
Medals: 23


I always win!


« on: 2008-11-23 17:48:41 »

I have a JFrame extending my class, and have enabled:
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);

All my key pressings go into this processKeyEvent method, EXCEPT when I press the VK_TAB key.

Any ideas?

1  
2  
3  
4  
5  
6  
7  
protected void processKeyEvent(KeyEvent e) {

if(e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_TAB) {
  // never arrives here!
}

}

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline phu004

Full Member
**

Posts: 109


NoSuchPersonException


« Reply #1 on: 2008-11-23 19:35:25 »

My guess is that:  when you press "tab", the jframe which the keylistner is added lost its focus.
Offline Abuse

JGO Kernel
*****

Posts: 1866
Medals: 5


falling into the abyss of reality


« Reply #2 on: 2008-11-23 20:30:57 »

Does this sound about right?

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4650902
Games published by our own members! Go get 'em!
Offline appel

JGO Wizard
****

Posts: 1477
Medals: 23


I always win!


« Reply #3 on: 2008-11-23 20:48:56 »


Yup, exactly!

The solution:
setFocusTraversalKeysEnabled(false);

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.088 seconds with 21 queries.