Questions tagged [keyevent]

An event that is triggered when a key is pressed,released or remains pressed on a keyboard input device.

A KeyEvent is an event that is triggered when a key is pressed, released or remains pressed on a keyboard input device. The event can contain:

  • info about particular key that was pressed/released
  • how long the key was pressed
  • whether any modifier keys were also pressed (such as Ctrl or Alt).
  • type of event - press, release, other (for example character was typed, regardless whether key was pressed or released)

Some platforms/keyboards may generate auto-repeat key events - same character is typed repeatedly while key remain pressed

1258 questions
0
votes
2 answers

How to use VK_UP or VK_DOWN to move to the previous or next Textfield?

I want to use the VK_UP or VK_DOWN to move the focus, so it can go to the previous or next textfield. How can i do that ? I tried using this, but it didnt work. private void passwordTFKeyTyped(java.awt.event.KeyEvent evt) { char c =…
radik
  • 3
  • 1
  • 2
  • 6
0
votes
1 answer

Android App options onkeydown

See that button in the right bottom corner with the red cercle around it. Sorry for the size! I would like to know if there is an KeyEvent for this key and how is the key called. Thanks a lot!
Ben Lefebvre
  • 359
  • 5
  • 21
0
votes
2 answers

Java KeyEvent and KeyListener

Is the Java KeyListener universal meaning that it will work for any application that I type into? If not, how can I make it universal?
Dylan Wheeler
  • 6,928
  • 14
  • 56
  • 80
0
votes
1 answer

Is it possible to throw a KeyEvent virtualy on a JTextfield?

Here is my problem I got my System.in that is redirected to a JTextField. Right now the user can press enter and it will send my text away. But my client will not have access to this JTextfield so i wanted to know if i could recreate the Enter key…
Alex
  • 865
  • 13
  • 24
0
votes
1 answer

Getting animation to work correctly with Java KeyEvent

I am stuck with getting my sprite character to execute 2 animation frames (link_frame_2 followed by link_frame_1) by pressing the d. It only executes one animation frame(link_frame_2_face_right.png). Here's the code: import java.awt.Point; import…
0
votes
1 answer

Firing key event ctrl + space on JTextArea?

I'm new to Java Swing. I need to fire event ctrl + space on JTextArea I could figure and find only one key event fired. Any directions?
RollRoll
  • 8,133
  • 20
  • 76
  • 135
-1
votes
1 answer

How to act only on first KeyEvent

I'm working on an app, where I show a question and a person can answer by using the arrow keys for yes/no, which loads a new question and so on. This works well, but I'm trying to implement a multiplayer mode aswell, where another person can use the…
-1
votes
2 answers

How to validate or sanitize arabic number input-data?

My task is to allow users to type arabic text in my input field, however they are unable to do so due to a function named isNumber() in the code. Without the isNumber() function, the users are able to type arabic text. I'm inspecting the code and I…
-1
votes
1 answer

How to run a method which has "KeyEvent e" as it's parameter?

Hi Devs I have a problem that how should I call it. If I write "null" in the parenthesis, it gives error that e is null. My code is below for reference. private void myMethod(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ …
-1
votes
1 answer

Edit text from a specific line at text area when a key is pressed using javafx?

So I'm working on building a text editor using java, javaFx, I have to open a file in the (Editor VBox) and put the lines in a double linked list, then edit, delete, overWrite a line etc.., I made a textArea called textAr in the Editor VBox, but I…
-1
votes
1 answer

Testing if a key is pressed in python

I would like to start a python script by using the keyboard shortcut Ctrl+Shift+H. When the script starts, the keys Ctrl and Shift may still be pressed (depending on how quickly I remove my fingers). I would like to be sure that these two keys are…
Zach
  • 600
  • 5
  • 16
-1
votes
2 answers

The image not showing up in JFrame after adding the movement

I am trying to make a PacMan alternative with a tiger chasing bagels (don't ask why). I'm on the first stage still, trying to make the tiger move around the JFrame. However, now that I implemented the KeyEvent, the image is no longer showing up. I…
Alty
  • 15
  • 4
-1
votes
1 answer

Casting Textbox KeyEventArgs

I am trying to get KeyUp events for textBox control at runtime but I am struggling to cast correctly. The code below compiles and I can see the event info when I add a Watch/Inspect rtbPrivateNote_KeyUp -> EventArgs e: public class Form1 { …
Belliez
  • 5,356
  • 12
  • 54
  • 62
-1
votes
1 answer

Best Practice for Text and list box input

I have a lengthy form containing multiply text boxes and list boxes in order to gather data. There is a logical sequence to the controls and the tab indexes are set to lead the user through. My problem is that I loose the plot when I try to control…
Kenny
  • 3
  • 2
-1
votes
1 answer

How can I set right KeyboardListener into my TextField in javafx Application?

I decided to create application for me. I wanted to set keyboard listener in my text field. There are 5 windows in my simple application and in the everyone has handler. All handlers different. But I can't make even one of them. it throw to me…