FAQ Database Discussion Community


Key typed event: getKeyCode() returns 0

java-8,keylistener,keyevent,keycode
I want to write this listener to the "keyTyped" event.(Not keyPressed event) Here's my code. private void jTableKeyTyped(java.awt.event.KeyEvent evt) { if (evt.getKeyCode()==KeyEvent.VK_ENTER){ int y = evt.getKeyCode(); System.out.println(y); } } The problem is that for any key is being typed, the results is 0. Why this isn't working....

Android get pressed key on keyboard

android,keyboard,keyevent
I would like get the pressed key on the keyboard, for all edittext etc.. For example I would log the pressed key in my test application. How can do that ?...

Java KeyBindings Combination does not work

java,windows,events,combinations,keyevent
I'm struggling with creating a way to identify key combinations. Before I can even set any booleans, I noticed that certain key combinations lead to ignoring other keys. package question; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke;...

javafx using translatetransition and keyevent to move image around screen

javafx,transition,move,translate,keyevent
I am trying to make a simple tile based movement system so that when a direction is pressed a translate transition is played to smoothly move the character one tile over. The problem I am running into is that when I play the animation the image does the transition fine...

Keyboard events java

java,computer-science,keylistener,keyevent
I have recently started learning java.I want to make a game like https://sites.google.com/site/millseagles/home/Games/multiplayer/tron I have made it in c++ once using a simple graphics lib. I have the graphics part down i plan to use small images and use http://horstmann.com/sjsu/graphics/ this basic graphics lib.I can't figure out keyboard input i...

Cannot find variable e.getkeycode

java,swing,keylistener,keyevent
I'm a beginning programmer using Java and I'm trying to make a game in which you toss a disc through a moving hoop. The disc has a constant downward force and can be moved upward using the up key; however, before I even added any collision detection I started getting...

Canvas: Click through images

javascript,html,image,canvas,keyevent
For an homework I wanted to make an interactive Story. Basicly it is only click through images with the UP and DOWN button. But my Problem is: My If function over writes the if function before It should work like clicking through a gallery, so very simple, but I canĀ“t...

java.lang.NoSuchMethodException: dispatchMediaKeyEvent [class android.view.KeyEvent]

android,android-mediaplayer,keyevent,android-audiomanager
I'm trying to use media events to play, pause, next, previous music from my android application. When I run it on Samsung s4 (Android version 4.4.2), I can perform all actions. But I'm unable to perform those actions from my Nexus 5 (Android version 5.0.1). I get error while handling...

getting keyboard input in winform listbox

c#,winforms,keyevent
i am altering a program so that a listbox picks up keyboard input (number pad, D0-D9, letter keys) and edits properties of the currently selected listbox item based on the input. my problem is that there seems to be no functionality that can convert a key press into a letter....

KeyEvent keyPressed key combination is blocked

java,blocking,keyevent,blocked
I've been struggling with the following problem for quite some hours now and can't find the solution. I'm currently working on a music/rhythm game, in which the user has to press certain keys at the right time to score points. Now, since it's supposed to be similar to playing piano,...

JavaFX TextField : Automatically transform text to uppercase

java,javafx,fxml,keyevent
I have a JavaFX TextField control on my FXMl that looks like this... <TextField fx:id="input_search" onKeyPressed="#keyListener" prefHeight="25.0" prefWidth="197.0" /> I want to automatically change all characters to uppercase when the user is typing. The code in my controller : public void keyListener(KeyEvent event){ //maybe transform the pressed key to uppercase...

Back key or Delete key of Soft Keyboard not working in 4.4 and 5.0?

android,layout,android-edittext,android-softkeyboard,keyevent
I am facing the issue of back key or del key which is not working in 4.4 and 5.0.1 devices ? When I press the back key of softkeyboard below method is not calling. Username.setOnKeyListener(controller); Password.setOnKeyListener(controller); @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.KEYCODE_DEL){ getActivity().setDisableLoginButton();...

Visual Studio debugger does not exit after application was killed

c#,wpf,visual-studio-2012,keyevent
Whenever I run the code via Visual Studio after second run it does not exit, meaning it is still running but visually it is down, yet it is visible via Taskmanager. I believe it has to do with buffer being filled with keys and it cannot handle the flow (after...

Android simulating play/pause button

android,android-intent,android-broadcast,keyevent,android-context
I'm trying to make my application open up Google Play Music and then simulate a play/pause command. My application is able to start Google Play Music successfully, but the downIntent and upIntent KeyEvents are never broadcast. I suspect this is because calling the method just invokes the method on my...

C# console key press event

c#,console-application,keyevent
I just started to learn c# console events. Is there a possible way that a c# application will automatically jump into a new command by just pressing a letter. I have this mini code below. I was developing a mini text base base. I just used the Console.Read(); so the...

Move a rectangle using arrow keys

java,keylistener,keyevent
I am trying to develop a simple game where you can move a rectangle using the left and right arrow keys and to shoot using the spacebar. I have added a KeyListener and others, but when I run it I have nothing as the output of key pressed or others....