View Full Version : Key Event..(java)
May 8, 2006, 09:39 PM
How do i code a simple coding so that when i press Del on the Keyboard my Label or Button will be deleted? i nv used key Listener Before.. can anyone Help me??
May 9, 2006, 06:28 AM
I am curious if you read what you wrote after you posted it?
Since you are new to ActionListener here is a good place to start. (http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/ActionListener.html)
Since you are looking for once the 'Del' button is pressed I would suggest starting here at the KeyStroke Class (http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/KeyStroke.html)...
Here are a few uses of the javax.swing.KeyStroke. (http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/class-use/KeyStroke.html)
May 9, 2006, 12:03 PM
Have a peek there! (http://java.sun.com/docs/books/tutorial/uiswing/)