About 399,000 results
Open links in new tab
  1. KeyEvent (Java Platform SE 8 ) - Oracle

    For key pressed and key released events, the getKeyCode method returns the event's keyCode. For key typed events, the getKeyCode method always returns VK_UNDEFINED. The getExtendedKeyCode method may also be used with many international keyboard layouts.

  2. java - How to use KeyEvent - Stack Overflow

    Nov 25, 2012 · I'm writing small graphics editor and I want catch event when I press Ctrl+A. I use such code (this is test version): @Override public void keyPressed(KeyEvent e) { System.out.println("Press"); switch (e.getKeyCode()){ case KeyEvent.VK_A : System.out.println("A"); break; } }

  3. applet - Java Keyboard Keycodes list - Stack Overflow

    Can anybody provide me with the Key Code integer list for individual keys used on the Keyboard for the KeyEvent class in java? I want to create a dropdown list of all the keyboard keys for the user to select.

  4. java - How to create a KeyEvent - Stack Overflow

    Feb 14, 2013 · Do you want to "dispatch" the event or simply pass it back via the KeyListener interface (ie kl.keyPressed(myHandedMadeEvent)? e is the KeyEvent. if you want to see the e value, then you can try this. Creating KeyEvent : Example (dunno if this is the right way, but it produce the right output): KeyEvent e; e = new KeyEvent(a, 1, 20, 1, 10, 'a');

  5. Event Handling in Java - GeeksforGeeks

    Feb 27, 2025 · An event is a change in the state of an object triggered by some action such as Clicking a button, Moving the cursor, Pressing a key on the keyboard, Scrolling a page, etc. In Java, the java.awt.event package provides various event classes to handle these actions. Classification of Events

  6. How to Write a Key Listener (The Java™ Tutorials - Oracle

    You can also query a key-pressed or key-released event to determine the location of the key that fired the event. Most key events are fired from the standard keyboard, but the events for some keys, such as Shift, have information on whether the user pressed the Shift key on the left or the right side of the keyboard.

  7. Keyboard Events in Java Example - Computer Notes

    It is a subclass of the abstract InputEvent class and is generated when the user presses or releases a key or does both i.e. types a character. When a key is pressed, the event generated is KEY_PRESSED. When a key is released, the event generated is KEY_RELEASED.

  8. KeyListener Java Example - Examples Java Code Geeks - 2025

    Nov 11, 2012 · Java key listener is an interface used in Java Swing to monitor keyboard-related events that take place in your applications. This is particularly useful when you want to perform input validation on form fields or add shortcut functionality to your application.

  9. A complete Key Event example - Java Code Geeks

    Nov 11, 2012 · In short, all you have to do in order to construct a simple application that demonstrates all key events is: Create a class that implements ActionListener and KeyListener interfaces. Override keyPressed, keyTyped, keyReleased to customize the handling of these specific events. Use event and input maps to print out the key events that occurred.

  10. Java Swing Key Events - Online Tutorials Library

    Learn about key events in Java Swing, including how to handle key presses and releases for interactive applications. Explore the essentials of handling key events in Java Swing for dynamic user interfaces.

  11. Some results have been removed
Refresh