About 193,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 KeyListener in AWT - GeeksforGeeks

    Nov 7, 2023 · In this article, we'll explore what the KeyListener is, and its declaration methods, and supply examples with explanatory comments. The KeyListener port in Java AWT is quite used to listen for keyboard events, such as key presses and key releases.

  4. 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; ...

  5. 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() .

  6. How to determine keycode in java - Stack Overflow

    Aug 23, 2012 · Java - Get keycode of a char. I have a String which can contain alphabet, digits, +, -, = etc. I want to get the key code of each character so that I can use that in KeyEventData() argument. I am able to detect only alphanumeric characters. How do I detect a keypress such as +, :, }, etc. which requires a shift key press?

  7. Java】キー入力処理 - ぽるろぐ

    Dec 10, 2017 · キー入力の方法には、KeyListenerを実装し、メソッドをオーバーライドして利用する方法とenableEventsで有効化し、processKeyEventメソッドをオーバーライドする方法があります。 今回は、KeyListenerをJFrameに実装して、キー入力する方法を紹介していきます。 キー入力を有効化するにはKeyListenerを実装し、JFrame等のaddKeyListenerを呼び出しましょう。 まずは、KeyListenerの実装ですが、keyPressed、keyReleased、keyTypedのメソッドを …

  8. 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 (); …

  9. 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.

  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;

  11. Some results have been removed
Refresh