• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Capturing/Consuming Alt+Tab combination under JFrame

 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am trying to capture the Alt+Tab combination key from my custom JFrame application. Is it possible under Java?

-BalaC-
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you try KeyEvent.VK_TAB?
 
Rancher
Posts: 3253
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is an OS level event in Windows and is handled by the OS.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Camick wrote:That is an OS level event in Windows and is handled by the OS.



Can it be done using JNI or is there a workaround ?
VNC
Does anybody know how VNC handles it ? Of course there is an option in VNC Viewer [ Options -> Inputs tab -> Check box stating (Pass special keys directly to server) ] but couldn't get the implementation in it's source code.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Balasubramanian Chandrasekaran wrote:Hi all,

I am trying to capture the Alt+Tab combination key from my custom JFrame application. Is it possible under Java?

-BalaC-



key events are fired by the component; now there should be a component( JComponent) which fires these key events and your JFrame is listening to these key events and in the implementation you filter the one which you are interested in and take any further action or consume the event etc..

In your case, do you have any of these component? i.e JTextField or JTextArea ?


Regards,
Alan Mehio
London,UK
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> key events are fired by the component;

key events are listened to via various means in a java app
keyListener
keyBinding
KeyBoardFocusmanager
AWTEventListener
etc

but the key events need to reach the java app, to be processed.

certain combinations are consumed by the os (particularly windows), prior to getting to the java app.
alt-tab
ctrl-alt-del
etc
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic