File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Capturing/Consuming Alt+Tab combination under JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Capturing/Consuming Alt+Tab combination under JFrame" Watch "Capturing/Consuming Alt+Tab combination under JFrame" New topic
Author

Capturing/Consuming Alt+Tab combination under JFrame

Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

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

Joined: Sep 13, 2007
Posts: 1963
    
    7

did you try KeyEvent.VK_TAB?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2090
    
    7
That is an OS level event in Windows and is handled by the OS.
Shirley Heby
Greenhorn

Joined: Sep 03, 2009
Posts: 3
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

Joined: Apr 04, 2005
Posts: 73
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

Regards,
Alan Mehio
London, UK
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Capturing/Consuming Alt+Tab combination under JFrame
 
Similar Threads
IntelliJ 4.0 : how to go from file to file?
Active Vs Foreground Window
how to get full control of screen through java plus some questions
JOptionPane.showConfirmDialog question
Shortcut key to set focus on JFrame