arrow key « Event « Java Swing Q&A





1. how to make the key arrows work?    stackoverflow.com

I am using Java and I can't make the key arrows work in the applet , can anyone help me? Here's the code I wrote

import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JApplet;
import javax.swing.JLabel;

public ...

2. arrow keys functionality    coderanch.com

3. how to move a rectangle with arrow keys,    java-forums.org

for some reason this only works for the right arrow key, and i commented out the code for the left arrow key. how do you edit the paint method in the keyhandler method below? or otherwise, how do you reference the keyhandler event/ keypressed in the paint method up top? import java.awt.Container; import java.awt.Color; import java.awt.Graphics; import java.awt.Point; import java.awt.event.KeyEvent; import ...