Skip to Main Content

New to Java

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!

JTextArea - how to clear it?

807597Aug 3 2005 — edited Dec 13 2007
Hi!
Could you help me, please?!
I've put some text to a JTextArea. Is it possible to remove it and get an empty box?
Here is my textArea:

textArea = new JTextArea(1, 30);
textArea.setBorder(new TitledBorder(new EtchedBorder(), "Test"));
textArea.setFont(displayFont);
textArea.setBackground(Color.white);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
....then I put some text.........

Here is what I've tried and what did not function:
Textarea.removeAll();
scrollPane.removeAll();
Textarea.remove(0);
scrollPane.remove(0);

Nata
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2008
Added on Aug 3 2005
9 comments
507 views