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
-1
votes
1 answer

Image will not dispose upon keyPressed Java

I am drawing on an image on JPanel's graphic context. However the image does not remove itself from the graphics context when I press S. I know for sure my keyListeners are working. If I am disposing the graphics context, shouldn't the content on…
Nicholas
  • 679
  • 2
  • 11
  • 29
-1
votes
4 answers

how to make key press not pause?

Okay, so I am making a 2D side scroller game for school. It is pretty much just like Mario (well, that is my hope for when I finish.) When I press the right arrow key to move my player along the map, he moves once, pauses, and then begins to…
GrayW3
  • 11
  • 1
  • 1
-1
votes
1 answer

How to run all methods of a java applet without specifically calling them?

I've just started creating a portal game through applet (yes I know it's totally outdated and I should be using swing blah blah blah), and so far I've only encountered one problem. The browser/appletviewer only calls paint and init automatically. If…
TheUnicornCow
  • 49
  • 1
  • 1
  • 5
-1
votes
1 answer

KeyListener stop working with Action or Mouse Listenter?

I want to add KeyListener to get input through keyboard, so i add keyListener and implements its methods, but when i run that and press any key it works but in console it write something like this: Exception in thread "AWT-EventQueue-0"…
-1
votes
1 answer

BroadcastReceiver doesn't work properly

I'm trying to write app using Broadcastreceiver. Unfortunately, it does not work properly (it does nothing). Could someone help me? Here is my code: import android.app.Activity; import android.content.BroadcastReceiver; import…
user1411291
  • 81
  • 1
  • 3
-2
votes
1 answer

Keyboard on view event is not working by Kotlin

Coding is easy for Keyboard event handling by Kotlin if write the following code override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { return when (keyCode) { KeyEvent.KEYCODE_ENTER -> { .... …
-2
votes
1 answer

on key pressed javafx scene builder

@FXML void afficher(KeyEvent event) { if (event.getCode() == KeyCode.ENTER) { } I want to make a simple key pessed method, but Netbeans underlines the getCode() in red whatever I do. I got: cannot find symbol symbol: method getCode()…
-2
votes
1 answer

Javascript: Stop until RETURN key is press

I'm newbie with javascript and I'm not able to figure out how to stop and wait until return key has been pressed. Any help is appreciated. Thanks in advance.
JPrado
  • 21
  • 1
  • 4
-2
votes
1 answer

onkeyup deprecated events clarification

I have a function with "onkeyup" event: document.onkeyup=function(e){ var e = e || window.event; if(e.altKey && e.which == 73) { alert('ALT+i has been pressed'); return false; } } That works in IE 11,Opera. In Firefox it…
Serg
  • 151
  • 10
-2
votes
1 answer

How to add / use a KeyEventHandler on to a empty C# project

I am in the process of making a C# WFA game engine, building it from a empty VS project / ground up. I have hit the point where i need to add input but have no idea of how to add a keyDown / keyUp event nor how to add or use a KeyEventHandler.…
K. Hansson
  • 21
  • 9
-2
votes
1 answer

Why every KeyEvent is successfully captured except KEYCODE.ENTER in my JavaFX Calculator app?

I'm writing a simple calculator app with JavaFX. Every keyboard event is successfully captured except the ENTER key. The EQUALS ("=") is the only hardware key that will trigger the calculation function. I have scoured every question on this site…
-2
votes
1 answer

Does object oriented programming work with 2 methods?

I have encountered a problem while writing code for a small game I've been working on. In the following code I am trying to use object oriented programming. as I am using KeyEvent I think I need to use 2 methods however for some reason int key…
-2
votes
2 answers

Android Emulator Power Key Long Press Event

I want to add item in the context menu of Power options, appear after long key press of Power. I have tried to capture event onkeyLongpress but its not working.
-2
votes
1 answer

Android: How can I handle the press of the keys?

I want to get a key pressing time, in milliseconds. Example if User press 'F' key i want to get the value in milliseconds of the pressing time. public void keyPressed(KeyEvent event) { int keyCode = event.getKeyCode(); switch (keyCode) { …
ChrisB
  • 1
  • 1
-2
votes
1 answer

how i can change the end of r.keyPress(KeyEvent.VK_W) the W out of the VK

Alright, So im doing Keypressed and keyreleased, and that works with VK_ stuff.... i have a GUi ready and im able to save and load config files, but i was wondering on how i can change the end of r.keyPress(KeyEvent.VK_W) the W out of the VK with my…
nyanchan
  • 3
  • 3
1 2 3
83
84