Sunday, September 18, 2011

Dialog


import javax.swing.JOptionPane;
public class FirstDialog
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null, "First dialog");
System.exit(0);
}
}

// The number indicate the return value

// 0. Display an ERROR message.
JOptionPane.showMessageDialog(null, "Invalid Data", "My Message Box",
JOptionPane.ERROR_MESSAGE);
// 1. Display an information message.
JOptionPane.showMessageDialog(null, "Information Message", "Information",
JOptionPane.INFORMATION_MESSAGE);
// 2. Display a warning message.
JOptionPane.showMessageDialog(null, "Warning Message", "Warning",
JOptionPane.WARNING_MESSAGE);
// 3. Display a question message.
JOptionPane.showMessageDialog(null, "Question Message", "Question",
JOptionPane.QUESTION_MESSAGE);
// -1. Display a plain message.
JOptionPane.showMessageDialog(null, "Plain Message", "Message",
JOptionPane.PLAIN_MESSAGE);

No comments:

Post a Comment