Key event capture

I can't find a way to capture the key events of the special key on multimedia keyboards, just like play/pause, browser or music..
Any ideas?

You probably can't. They have their own drivers to handle those specialties and Java (as far as I know) doesn't have support for those.

Similar Messages

  • Capture desktop key event to control my screen capture app

    I want to write a screen capture program to capture screen when I am playing fullscreen game or other desktop window application. But the java screen capture program can only receive key or mouse event when it is focused. So how do I capture key event when I am focusing other app or fullscreen app?
    Do I have to use JNI and call some OS specific API. My target OS is WinXP. Help or suggestions are appreciated!!

    Hi All,
    I was wondering if there is a way to capture the top-most
    window or dialog box. This is something that will
    generally be running outside of the JVM....We,
    as programmers, need a Rectangle instance that describes the area
    of interest to be captured (i.e., location and size).
    Thus, a routine that interfaces to the Native windowing system (Toolkit?)
    might look something like:
    Rectangle rect = tk.getRectangleForTopMostComponent();
    Does anything like this exist?
    Thanks!
    - DocJava

  • Capturing Enter key event from text box

    In my application, there are a number of text boxes. I want to create a feature where an enter key even is seen and specific function executed depending on which text box was in focus when the enter key was pressed. Currently I am able to capture an enter key event on the whole page. How do I do that specifically for a text box?
    This application is done in HTML, javascript and Adobe AIR.
    Thanks
    Binu
    www.verseview.info

    Hi
    That's true that Flex4.5 SDK under Flash builder Burito doesn't listen Enter key in Text Area for KeyUp or KeyDown event.
    Here I found a work around you can use.
    Add an eventlistener to the component in actionscript and set the useCapture=true next to eventlistener function. Now you can listen enter key for KeyUp or KeyDown Event
    Hope this helps
    Rush-me

  • KeyListener does not capture Arrow key Events in textField

    Love................
    I added a key listener to TextField it does not detect
    Arrow Keys events in keyTyped, KeyPressed,KeyReleased methods
    why?????
    I want to shift focus from a textfield to other component
    on capturing Arrow key Pressed How

    Here is a Java demo where it works since it is not a printable character you must get the keyCode:
    http://java.sun.com/docs/books/tutorial/uiswing/events/example-swing/index.html#KeyEventDemo
    public class KeyEventDemo ... implements KeyListener ... {
    ...//where initialization occurs:
         typingArea = new JTextField(20);
         typingArea.addKeyListener(this);
    /** Handle the key typed event from the text field. */
    public void keyTyped(KeyEvent e) {
         displayInfo(e, "KEY TYPED: ");
    /** Handle the key pressed event from the text field. */
    public void keyPressed(KeyEvent e) {
         displayInfo(e, "KEY PRESSED: ");
    /** Handle the key released event from the text field. */
    public void keyReleased(KeyEvent e) {
         displayInfo(e, "KEY RELEASED: ");
    protected void displayInfo(KeyEvent e, String s){
         char c = e.getKeyChar();
         int keyCode = e.getKeyCode();
         int modifiers = e.getModifiers();
         tmpString = KeyEvent.getKeyModifiersText(modifiers);
         ...//display information about the KeyEvent...
    }

  • Can't capture key event in applet

    Hi,
    Currently i'm developing an applet. However, i fail to capture the key event in the applet. The key that i fail to capture is VK_TAB. Any idea to handle this?
    Thanks in advance!

    to capture key event, u need to
    1. addKeyListener
    2. focus on that component (yourApplet must focusable)

  • How to capture backspave and delete key events

    Hi ,
    i would like perform some javascript code on pressing backspace or delete key.
    initially i thought of adf clientlsitener keypress event.but this is not capturing backsapce key event
    what is the alternate way capture backspace or delete key event?
    please help

    Hi
    the following script cancels the input event when the back key is pressed
           function keyTrap(inputEvent){
             var keycode = inputEvent.getKeyCode();
             if(keycode ==8){
               inputEvent.cancel();
           }Use a clientListener
            <af:inputText label="Label 4" id="it7">
              <af:clientListener method="keyTrap" type="keyDown"/>
            </af:inputText>Frank

  • Capturing the TAB key event.

    How can I capture the TAB key event?
    I am trying to use it within a JTextField to do a normal text tab operation.
    Thanks,
    D

    I want to map the Tab key to a jTextField so that when the user is editing inside the jTextField they can press the TAB key to tab over a predefined number of characters.
    Thanks,
    D

  • Capture Key events

    I am trying to create a program to capture key events, regardless of where the focus is. For example, any time the user presses ctrl-t, I would like to call a particular method, if the user is in Microsoft Word, Internet Explorer, Halo, or any other application. However, a glass pane would not work, because all other key events will be needed by the current application. This would be identical to Microsoft' s ctrl-alt-del and Microsoft's alt-tab. Any ideas would be greatly appriciated. Post here or E-mail be at [email protected]

    This is not true, think of all the keylogger programs out there that allow you to do this.
    It's not a security issue.
    I also am wondering how to capture a key on a java application without it having focus. An example is a timer in a game. I should be able to be in a full screen game and hit F1 or Home or whatever I choose and have a timer start that will ding at me in 1 minute to let me know that my time is up.
    It is in a way similar to CTRL ALT DEL in that you don't ahve to be focused on anything in particular to use it but that isn't really the best analogy.
    If anyone can point me in the right direction to figure out how I would go about this, please tell me. Or if it is not possible for a program written in java to capture keypress without focus I would like to know that as well.
    You can do this in C and C++ but I would like to just add it in to an existing java program, thanks.

  • Key events on the glasspane

    I'm trying to develop a glasspane that captures the key events as well as the mouse events.. In this example, the mouse events happen exactly the way I want them to, but I cannot for the life of me get a key event to register.. I've tried capturing keyTyped(), keyPressed(), and keyReleased() to no avail.. Dukes to whoever shows me the light,
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class BCInv
        extends JFrame {
      JScrollPane jScrollPane1 = new JScrollPane();
      JTextArea jTextArea1 = new JTextArea();
      JScrollPane jScrollPane2 = new JScrollPane();
      JTable jTable1 = new JTable();
      JButton jButton1 = new JButton();
      public BCInv() {
        jbInit();
        setVisible(true);
        getGlassPane().setVisible(true);
        //here I'm adding both listeners in the same manner
        getGlassPane().addMouseListener(new BCInv_mouseAdapter());
        getGlassPane().addKeyListener(new BCInv_keyAdapter());
      public void jbInit() {
        setSize(new Dimension(611, 423));
        getContentPane().setLayout(null);
        jScrollPane1.setBounds(new Rectangle(9, 275, 574, 110));
        jTextArea1.setText("jTextArea1");
        jScrollPane2.setBounds(new Rectangle(10, 13, 573, 175));
        jButton1.setBounds(new Rectangle(196, 217, 89, 42));
        jButton1.setText("jButton1");
        this.getContentPane().add(jScrollPane1, null);
        this.getContentPane().add(jScrollPane2, null);
        this.getContentPane().add(jButton1, null);
        jScrollPane2.getViewport().add(jTable1, null);
        jScrollPane1.getViewport().add(jTextArea1, null);
      public static void main(String[] args) {
        BCInv BC = new BCInv();
      //this key stuff here never executes..
      void BCkey(KeyEvent e) {
        System.out.println("A key was typed: '"+e.getKeyChar()+"' = "+e.getKeyCode());
      class BCInv_keyAdapter extends java.awt.event.KeyAdapter {
        BCInv_keyAdapter() {}
        public void keyTyped(KeyEvent e) {
          BCkey(e);
      //All this mouse stuff works great..
      void BCmouseClicked(MouseEvent e) {
        System.out.println("click");
        Point glassPanePoint = e.getPoint();
        boolean inButton = false;
        boolean inMenuBar = false;
        Component component = null;
        Container container = getContentPane();
        Point containerPoint = SwingUtilities.convertPoint(
            getGlassPane(),
            glassPanePoint,
            getContentPane());
        component = SwingUtilities.getDeepestComponentAt(
            container,
            containerPoint.x,
            containerPoint.y);
        if (component == null) {
          return;
        System.out.println("underlying component="+component.toString());
      class BCInv_mouseAdapter
          extends java.awt.event.MouseAdapter {
        BCInv_mouseAdapter() {}
        public void mouseClicked(MouseEvent e) {
          BCmouseClicked(e);
    }

    * @author nordj
    public class GlassPane extends JPanel {
         private boolean okToLooseFocus = true;
         public GlassPane() {
              setName("GlassPane");
              setVisible(false);
              super.setOpaque(false);
              //super.setBackground(new Color(0x00,0x00,0x00,0x88));
              //super.setForeground(new Color(0x00,0x00,0x00,0xFF));
              // trap keyboard & mouse events.
              //enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
              enableEvents(0xFFFFFFFFFFFFFFFFl);
              setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
              setInputVerifier(new GlassPaneInputVerifier());
         /* (non-Javadoc)
          * @see java.awt.Component#processMouseEvent(java.awt.event.MouseEvent)
         protected void processMouseEvent(MouseEvent e) {
              if (e.getID() == e.MOUSE_CLICKED) {
                   Toolkit.getDefaultToolkit().beep();
                   e.consume();
              super.processMouseEvent(e);
         /* (non-Javadoc)
          * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
         protected void processKeyEvent(KeyEvent e) {
              Toolkit.getDefaultToolkit().beep();
              super.processKeyEvent(e);
         /* (non-Javadoc)
          * @see java.awt.Component#processEvent(java.awt.AWTEvent)
         protected void processEvent(AWTEvent e) {
              // TODO Auto-generated method stub
              //System.err.println(e);
              super.processEvent(e);
         /* (non-Javadoc)
          * @see java.awt.Component#setVisible(boolean)
         public void setVisible(boolean visible) {
              okToLooseFocus = !visible;
              super.setVisible(visible);
              if (visible) {
                   requestFocusInWindow();
         /* (non-Javadoc)
          * @see java.awt.Component#paint(java.awt.Graphics)
         public void paint(Graphics g) {
              g.setColor(new Color(0xFF,0x00,0x00,0x88));
              g.fillRect(0,0,getWidth(), getHeight());
          * Simple hack to stop the RootPane loosing focus when it's visible
          * @author nordj
         private class GlassPaneInputVerifier extends InputVerifier {
              /* (non-Javadoc)
               * @see javax.swing.InputVerifier#verify(javax.swing.JComponent)
              public boolean verify(JComponent input) {
                   //return (!isVisible());
                   return okToLooseFocus;
    }

  • Need key events in JPanel

    I can't receive key events in a JPanel, and need to figure out how. While the JDialog I added my JPanel to originally could catch these, once I added more components (like a JTextBox and JCheckBox), neither my panel nor dialog caught any key events at all. Isn't there some way when my panel has focus to capture and respond to key press events?
    Thanks,
    Mark McKay
    http://www.kitfox.com

    This works for a JFrame, didn't test it on a JDialog:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class PanelEvents extends JFrame
         public PanelEvents()
              JPanel main = new JPanel();
              main.setPreferredSize( new Dimension(300, 300) );
              main.setFocusable(true);
              getContentPane().add( main );
              main.addMouseListener( new MouseAdapter()
                   public void mousePressed(MouseEvent e)
                        e.getComponent().requestFocusInWindow();
                        System.out.println(e.getPoint());
              main.addKeyListener( new KeyAdapter()
                   public void keyTyped(KeyEvent e)
                        System.out.println(e.getKeyChar());
              getContentPane().add(new JTextField(), BorderLayout.NORTH);
         public static void main(String[] args)
              JFrame frame = new PanelEvents();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    }

  • ShortCut Keys Event

    Hi all,
    How I do for get Shortcut keys event inside form?
    for example:
    CTRL + C.
    Thank

    Hi Wesley,
    You need to use Menu events to capture such shortcut keys. For example, Ctrl+C corresponds to Menu UID 772. You can capture this event by listening to et_MENU_CLICK event and checking its Menu UID.
    I would also suggest looking at Events Logger tool (part of B1DE) which gives you a comprehensive view of all events raised when an action is performed in Business One.
    HTH
    Aravind

  • How to send Remote controller key event

    Hi Sir,
    Can anyone tell me "how to send key event from "Remote
    Controller" to Flex application?
    for example. I want to control the Flash player or my Flex UI
    application from remote controller such as use firefly
    controller/streamzap controller/Gyration controller. Normally user
    will use mouse or keyboard to enter/generate event, now I want to
    use "Remote controller" to generate the key event. In Flex, how can
    I capture the key event from "remote controller"? Any sample code
    to provide that will be good.
    Thanks.
    Lin

    Here's a couple related threads
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=583877
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=712386
    I'd also suggest exploring the Search Forums available on the left,
    which is how I found those threads:
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=focus+traversal+tab+text&subCat=siteforumid%3Ajava57&site=dev&dftab=siteforumid%3Ajava57&chooseCat=javaall&col=developer-forums

  • Macbook misses some key events for a few seconds

    I have noticed that for last two months or so something strange happens to my Retina MBP. Once in a couple of days it stops responding to some key events. It is like it handles only one keypress out of 4-5. Nothing seems to be wrong with the keyboard and it is not about a particular key or keys. And about 10-15 seconds later everything goes back to normal. I do not see any suspicious messages in the logs, the computer is connected to the power supply...It happens just by itself in the middle of the day, when I am typing.
    Almost looks like some interrupts get lost by the system while it is busy with something else. But I have checked the load level and running processes - nothing interesting there....And whatever it is - it happens during a very short period of time.

    Hi,
    No, I have not returned my MBP yet. In fact, I would rather avoid doing this unless I am convinced if it is a hardware issue. And I do believe it is not. Just recently I have spent some time investigating it and I have found very stroing correlation between the moments when this happens and these messages in the kernel log:
    Jan 13 10:49:54 mbp-wifi kernel[0]: Sandbox: sandboxd(96471) deny mach-lookup com.apple.coresymbolicationd
    Jan 13 10:54:31 mbp-wifi kernel[0]: Sandbox: sandboxd(96499) deny mach-lookup com.apple.coresymbolicationd
    Jan 13 10:54:31 mbp-wifi.home sandboxd[96499] ([96497]): mdworker(96497) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:54:31 mbp-wifi.home sandboxd[96499] ([96498]): mdworker(96498) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:56:32 mbp-wifi.home sandboxd[96504] ([96503]): mdworker(96503) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:56:32 mbp-wifi.home sandboxd[96504] ([96502]): mdworker(96502) deny mach-lookup com.apple.ls.boxd
    And I have also noticed that my Spotlight database gets reconstructed too often, which means it gets corrupted.
    From all this I conclude that it is most likely the software issue and it seems to be linked to spotlight. I saw people reporting similar things. So now I am researching on how to fix it without disabling the spotlight.
    In general, I believe that the quality of Apple software is going down, it is not like 4-5 years ago And Apple does seem to care less and less about it.
    If in your case it happens all the time, not just once in a while, and you see that a particular key has problems - it is possible that we are talking about the different issues and yours might be really about the keyboard.

  • Detect key events on anything

    If I have a JFrame with many components on it, how do I detect if a key is pressed, without having to add a listener to every component? For example, how can I check for the escape key being pressed, but not having to have componentN.addKeyListener(this); for everything?
    Thanks
    US101

    The correct way to collect the key events is the following:
    from java 1.2 to java 1.3 use the FocusManager. This class can be found in the javax.swing package. You would then need to extend the DefaultFocusManager and override specific behavior.
    for java 1.4 use the KeyBoardFocusManager. This class can be found in the java.awt package.
    Please see the following for a better explanation:
    http://java.sun.com/j2se/1.4/docs/api/java/awt/doc-files/FocusSpec.html
    Thanks for your time,
    Nate

  • Catching key events in application

    I have a JFrame with a JDesktop containing lots of JInternalFrame with various of components such as JTextFields etc.
    Now, i want to have a "main" listener that will catch key events no matter which component that has focus. For example pressing CTRL+A should produce something in the application no matter which component that has focus.
    How do I implement this in an easy way?

    It doesnt seem to work to add a KeyListener to the JFrame...
    this.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent e){
                        System.out.println("KeyTyped()");
                   public void keyPressed(KeyEvent e){
                        System.out.println("KeyTyped()");
              });Adding that to the JFrame gives nothing to System.out when a JTextArea inside an JInternalFrame has focus.

Maybe you are looking for