Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Delete last character in JtextArea

843804Mar 10 2005 — edited Mar 11 2005
I have a Jtextarea and keypad, the keypad is used to enter text to the JtextArea. I have a button on the keypad that is used for two things:
1. To move back through the text
2. To delete a character at a time

I do not kno how to go about deleting a character at a time, i have tried using deletCharAt() and giving the position to delete.
int count = 0;
System.out.println("pressed BCK");
 txtmsg = (display.getText());
count = txtmsg.length();
System.out.println(count);
        		    
		if (e.getSource()==keys[9])
		{
			System.out.println("pressed BCK twice - DELETE");
			txtmsg.deleteCharAt(count);
			display.setText(display.getText());
		}
This results in the following error cannot find symbol method deleteCharAt().
Txtmsg is a variable of type string, and display is the name for the JtextArea.

Any help appreciated, thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2005
Added on Mar 10 2005
3 comments
412 views