i have a java program.i have inserted a JTextArea. basically i want to create a button thatwill clear the text area.i dnt no hw,could u plx forward me sum ideas and maybe sum code.thanku.
Printable View
i have a java program.i have inserted a JTextArea. basically i want to create a button thatwill clear the text area.i dnt no hw,could u plx forward me sum ideas and maybe sum code.thanku.
Have you looked at other recently posted Java programs? Some of those have examples of using buttons.
Hint: To clear a textarea set its contents to "" (an empty string)
http://java.sun.com/docs/books/tutorial/uiswing/Quote:
Originally Posted by kamon
Hi everyone,
you can do this
Richard WestCode:JTextArea.setText("");
That would be the function of the method invoked in the registered ActionListener responding to the ActionEvent triggered by the push of the "Clear Text" JButton ...