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
Solved

Clearing text and message prompts

Posted on 1998-07-16
5
189 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

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

Suggested Solutions

Title # Comments Views Activity
more than one jdk and one jre 1 50
hibernate jars 4 45
ejb entity bean example issue 2 16
Running JavaFX on the Raspberry Pi 27 37
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…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

808 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