This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?
The quieter you are, the more you are able to hear.