Questions tagged [key-events]

An event that is triggered when a Key is pressed on a keyboard input device

A KeyEvent is an event that is triggered when a Key is pressed on a keyboard input device. The event will contain information relating to the particular key that was pressed, how long the key was pressed for, and whether any modifier keys were also pressed (such as Ctrl or Alt).

204 questions
3
votes
0 answers

Node-based automated testing of browser key events

I'm trying to write automated tests for Hashify Editor. Here are the sorts of assertions I'd like to make: Assert that a textarea matches a particular selector. Assert that the textarea is currently empty. Type "_" into the textarea. Assert that it…
davidchambers
  • 23,918
  • 16
  • 76
  • 105
3
votes
4 answers

Java KeyListener: How to perform an action when two keys are pressed?

Please have a look at the following code import java.awt.event.*; import javax.swing.*; import java.awt.*; public class KeyCheck extends JFrame { private JButton check; private JPanel panel; private FlowLayout flow; public…
PeakGen
  • 21,894
  • 86
  • 261
  • 463
3
votes
4 answers

KeyDown event is not firing, KeyPreview set to true

I'm building a small Forms application, i've just started it. But i have this problem: if i put a Control to the form, the KeyDown event is not firing. I'm aware of the KeyPreview property, and set it to true. But that didn't helped... :( I also…
WonderCsabo
  • 11,947
  • 13
  • 63
  • 105
2
votes
3 answers

Get a key from JTextArea

All I want to do, If I'm pressing '{' this key in JtextArea.automatically '}' this will be print also. if(evt.KEY_PRESSED == '{') System.out.print("}"); is this is okay??
Adnan
  • 45
  • 6
2
votes
1 answer

"Windows key" + "other key" - Java doesn't detect "other key"

Is there any solution that corresponds to the problem from the topic. If I press e.g. Windows key + Space, I get: keyTyped: Windows I guess it should be: keyTyped: Windows keyTyped: Space keyReleased: Windows keyReleased: Space My code:…
peter
  • 631
  • 2
  • 7
  • 18
2
votes
3 answers

Why do key bindings die?

This application needs to send a motor move command when a GUI button or an arrow key is pressed and a motor stop command when the GUI button or an arrow key is released. These bindings work fine for the down arrow until the corresponding GUI button…
jacknad
  • 13,483
  • 40
  • 124
  • 194
2
votes
4 answers

Key combination of characters (non-Ctrl or Alt) in Java

I'm doing a project that needs to detect if a certain key combination has been pressed. Any keys like Ctrl, Alt, A-Z and 0-9 can be used as key combination. I've searched some codes using KeyStroke.getKeyStroke but it seems like it does not allow…
Jemp
  • 351
  • 3
  • 7
  • 18
2
votes
2 answers

How to capture keyboard inputs in my JWindow using Java?

When i press keyboard with F1 to 12 or 0 to 9 or A to Z (all buttons). I do not see its capturing my keyboard inputs. How do i fix this? public class Boot extends JWindow implements KeyListener { public Boot() { ..... …
user285594
2
votes
3 answers

How can I detect CTRL+SHIFT+ANY_KEY using a KeyAdapter?

Here's my code: tabbedPane.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { CheckShortcut controlShortcut = (key) -> { return…
Ericson Willians
  • 7,606
  • 11
  • 63
  • 114
2
votes
2 answers

Creating KeyEvent with specific fields

How would I go about changing the fields of a generated KeyEvent? Actual KeyEvent from…
user3552325
  • 407
  • 5
  • 14
2
votes
1 answer

Combination of At.js and CodeMirror

I'm attempting to combine CodeMirror and At.js into a single "editor". I'm using At.js in a current version of the the editor to insert bits of HTML which represent certain aspects of a DSL. So at.js basically handles the autocompletion part of the…
Byebye
  • 934
  • 7
  • 24
2
votes
1 answer

How to show keypad,when Activity starts for AutoCompleteTextView in Android

We want to show keypad default when activity starts for AutoCompleteTextView. But AutocompletedTextview is placed in one of the fragment class.When fragement starts default our keypad has be shown. We tried with three cases: Case 1: …
2
votes
1 answer

What is the reliable way to detect OS using Javascript?

The use of navigator.userAgent is not advised as per MDN. In my application I want to have a shortcut for del key. In mac del key (is backspace) with charCode = 8. In windows del key charCode = 46. I want to treat both keyEvents same. I am currently…
Prabhakar Kasi
  • 531
  • 4
  • 18
2
votes
1 answer

Android key event generic for all activities

I want below keyevents into all activity. I have approx 15 activities. @Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_D: moveShip(MOVE_LEFT); return…
NovusMobile
  • 1,813
  • 2
  • 21
  • 48
2
votes
2 answers

NSTableView - How to remove the Spacebar event listener?

in my Mac application, I have a NSTableView. The default behavior is that clicking on the spacebar on the keyboard it selects a row and event tableView shouldSelectRow. In my use case however I have a button that starts and stops audio playback. I…
Mozzak
  • 201
  • 3
  • 16