-
Using Keyevent
String mess = "Hello".
I want to use JOptionPane.ShowInputDialog and if the user presses backspace, the code is supposed to remove the last letter of 'mess'.
But I have NO IDEA how to use KeyListener or Keyevent. So could anyone show me a simple code to show me how to use those methods?
I looked at many other sources, but the codes are only fragments and i am too much of a noob to figure out the rest.
-
Re: Using Keyevent
There are some examples here:
How to Write a Key Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
Start with a simple program that catches key events and work with it to see how it key events work.