Solved

Clearing text and message prompts

Posted on 1998-07-16
5
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

726 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