Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



Posted on 2004-03-30
Medium Priority
Last Modified: 2012-06-21
I have six JTextFields on JPanel and I need to verify all inputs in JTextFields.
Depend on validation of inputs, my program need generate JOptionPane.showMessageDialog. However, there so many different cases, and I can't write JOptionPane.showMessageDialog for each different case.
My qustion is how do I get all different dialog message by using only one JOptionPane.showMessageDialog statement?

For example, if a user didn't put anything and just press 'verify' button, JOptionPane.showMessageDialog should show all six different mssages. If a user put  threee valid inputs, then three messages for invalid input should be on JOptionPane.
Question by:dkim18
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

Accepted Solution

mmuruganandam earned 840 total points
ID: 10721037

String lineSeparator = System.getProperty("line.separator");
StringBuffer message = new StringBuffer();
message.append("message 1");
message.append("message 2");
message.append("message 6");

showMessageDialog(parentComponent, message, title, messageType);

This way, you can show all the messages in one message box.

LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 160 total points
ID: 10721156
>> showMessageDialog(parentComponent, message, title, messageType);


showMessageDialog ( parentComponent, message.toString (), title, messageType ) ;

Expert Comment

ID: 10721179
Thanks for the correction mayankeagle!
LVL 30

Expert Comment

by:Mayank S
ID: 10721327

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

688 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