Re: JOptionPane



Are you using one of the standard dialogues? If so it should be modal. The rest of your application should be blocked until you close the dialog.

For example:
if (JOptionPane.showConfirmDialog (this, "Delete this?", "Delete", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
// do clicked Yes stuff
}
else {
// do clicked No stuff
}

Shows a modal dialog box (i.e. one that will wait for an answer) with Yes & No buttons in it.




"mamta81" <roy.mamta@xxxxxxxxx> wrote in message news:535415ec-86bb-4d57-85f6-5c604fb5c88a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
HI friends,
i have a problem. Suppose i have a JButton . When it is
clicked a JOptionPane will appear.The number of times button will be
clicked that number of times the JOption Pane appears.So i have to
click on the OK button of that JOption Pane that number of times. Is
there any solution so that no matter how many times the button iis
clicked the JOption Pane will appear only once.
Please help

.


Quantcast