posted 13 years ago
I was working on simple Swing application, and I got stuck - again! The application is something similar to Windows Command Prompt.
This is the deal now:
I have a JTextField where user can enter command; the response is shown in the JTextArea above it.
I am waiting for the command in the field until user presses Enter key. After that some logic is invoked, and result is displayed inside of JTextArea. I also have one more event assocciated with JTextField - when any key is pressed, character pressed is appended to text in JTextArea, so it lookes like user is typing command in JEditorPane. And now, I don't know how can I make application remove last entered characted from JTextArea if user presses Backspace (just in case user wants to change/correct entered command)?
One way might be to retreive all the text from text area, then "manually" remove last character and then set new text again. But, I was wondering if there is a "more ellegant" way to do that?
Thanks!
The quieter you are, the more you are able to hear.