About 192,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 - KeyEvent.getKeyCode() always returns zero - Stack Overflow

    Nov 26, 2016 · Here's what the javadoc says about getKeyCode() Returns: the integer code for an actual key on the keyboard. (For KEY_TYPED events, the keyCode is VK_UNDEFINED .)

  3. java - How to use KeyEvent - Stack Overflow

    Nov 25, 2012 · switch (e.getKeyCode()) { case KeyEvent.VK_A : if(e.isControlDown()) System.out.println("A and Ctrl are pressed."); else System.out.println("Only A is pressed"); break; ...

  4. How to Use Keycode in Java - Delft Stack

    Feb 2, 2024 · To get the key code pressed, we call the getKeyCode() method using the KeyEvent object and concatenate the result with a string. We also get the text that represents the key code using the method KeyEvent.getKeyText() and pass e.getKeyCode() .

  5. Class KeyEvent - University of Texas at Austin

    getKeyCode public int getKeyCode() Returns the integer key-code associated with the key in this event. Returns: the integer code for an actual key on the keyboard. (For KEY_TYPED events, keyCode is VK_UNDEFINED.)

  6. Java KeyEvent.getKeyCode () return a virtual key or ASCII?

    Feb 23, 2015 · KeyEvent.getKeyCode () return ASCII or Virtual Key? From the docs: The key being pressed or released is indicated by the getKeyCode and getExtendedKeyCode methods, which return a virtual key code. You can count the number of keycodes yourself from the doc of java.lang.Enum.KeyCode:

  7. getKeyCode() In KeyEvent-Java Example Program Sample Source …

    import java.awt.*; import java.awt.event.*; public class GetKeyCodeExample { Label label; public GetKeyCodeExample { Frame frame = new Frame (); TextField textField = new TextField (); …

  8. KeyEvent (Java SE 17 & JDK 17) - 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.

  9. Keyboard Events in Java Example - Computer Notes

    int getKeyCode() It is used for getting the integer code associated with a key. It is used for KEY_PRESSED and KEY_RELEASED events. The keycodes are defined as constants in KeyEvent class. char getKeyChar() This method is used to get the Unicode character of the key pressed. It works with the KEY_TYPED events

  10. Java Tutorial - Java KeyEvent.getKeyCode ()

    KeyEvent.getKeyCode () has the following syntax. In the following code shows how to use KeyEvent.getKeyCode () method. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; //from ww w. ja v a 2s . c o m import javax.swing.InputVerifier;

Refresh