JOption PAne

M

mamta81

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
 
A

Andrew Thompson

HI friends,
               i have a problem.

Multi-posting? This is solved by either
a) Making a post to only one group, or..
b) Cross-posting.

Please refarin from multi-posting in future.

(X-post to c.l.j.p./g., f/ f-u set to c.l.j.p. only)
 
R

RedGrittyBrick

mamta81 said:
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


Maybe something like ...

button.addActionListener(new ActionListener() {
void actionPerformed(ActionEvent e) {
button.setEnabled(false);
JOptionPane.showMessageDialog(...);
button.setEnabled(true);
}
});
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top