• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Capturing/Consuming Alt+Tab combination under JFrame

 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • 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-
 
K. Tsang
Bartender
Posts: 3507
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try KeyEvent.VK_TAB?
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is an OS level event in Windows and is handled by the OS.
 
Shirley Heby
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Alan Mehio
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic