JOptionPane.showMessageDialog(this, Ex.getMessage().toString());

JOptionPane.showMessageDialog(this, Ex.getMessage().toString());

JOptionPane.showMessageDialog(this, "Select Minimum 1 Quasi Identifier", "Exact Knowledge", 1);

Hi,the above statement why we put 1 at the end of the statement?

View Answers

June 28, 2011 at 2:54 PM

The showMessageDialog() consists of 4 or 5 parameters. The above statement shows the method with four parameters where first parameters shows the name of parent component, second one for message, third for title to be shown on dialog and fourth one shows the message type.

The parameter messageType means the type of message that is to be displayed: ERRORMESSAGE, INFORMATIONMESSAGE, WARNINGMESSAGE, QUESTIONMESSAGE, or PLAINMESSAGE. These message will be displayed with JOPtionPane class, like JOptionPaneERROR_MESSAGE. They are of integer type. So if you write 1, nothing will get happen. But if you will use JOptionPane with any of the above fields, then you will get the different look of the dialog box.









Related Tutorials/Questions & Answers:

Ads