Solved

Clearing text and message prompts

Posted on 1998-07-16
5
188 Views
Last Modified: 2010-03-30
How do you clear text from a textarea and from list box? Please give me the exact method.

Also how do you get a message prompt to display, which shows a message and allows you to click OK

Thanks

Mel
0
Comment
Question by:help_me
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:gadio
ID: 1226828
use
TextArea.setText("");
0
 
LVL 5

Accepted Solution

by:
msmolyak earned 50 total points
ID: 1226829
TextComponent.setText("") will clear the text area.

In List you can use removeAll() though I found it to be faster (especially for lists with many items) to create a new, empty list and replace the existing one.

I am not sure I understand the part about the message prompt. Could you elaborate?
0
 

Author Comment

by:help_me
ID: 1226830
Please could you help further with the following:
Is there a method that will clear the text area completely, as I recall setText only
clears the first part of it.
For the message prompt I mean a small message box which will appear when the user clicks on a button. It will contain a message and an OK and Cancel button.

Thanks
Mel
 
0
 

Author Comment

by:help_me
ID: 1226831
Please could you help further with the following:
Is there a method that will clear the text area completely, as I recall setText only
clears the first part of it.
For the message prompt I mean a small message box which will appear when the user clicks on a button. It will contain a message and an OK and Cancel button.

Thanks
Mel
 
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1226832
Mel,

What do you mean by "first part of text area"?

As for the message box, AWT has nothing of the like, you would have to subclass Dialog and create your own notification box, which is not terribly difficult.

Swing, on the other hand, has exactly what you need in the class JOptionPane.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
map related example 6 47
arguments to jar 5 26
hibernate example using maven 12 41
Java: How do I open the default windows program for a given file type 3 28
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question