Link to home
Start Free TrialLog in
Avatar of chenwei
chenwei

asked on

How to popup a message?

In my Java-Program I want to pop up a message dialog or message box such as:

...
...
if(error)
  pop-up error message;

...
...

Is there any easy way to do that?
Avatar of mmuruganandam
mmuruganandam
Flag of United States of America image

JOptionPane.showMessageDialog(this, "message", "Error occured", JOptionPane.WARNING_MESSAGE);

JOptionPane.showMessageDialog(this, "message", "Error occured", JOptionPane.ERROR_MESSAGE);

and so on....



ASKER CERTIFIED SOLUTION
Avatar of mmuruganandam
mmuruganandam
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mayank S
import javax.swing.* or javax.swing.JOptionPane for that. The parameters are: parent-frame, message, title, type-of-message.