Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

java confirmation dialog

Fri Nov 07, 2008 12:45 pm

we've got a confirmation dialog applied when closing a
window...there's the usual yes and no option in the dialog...when
pressing the yes window the window closes it also happens when you
press the no button which is not suppose to happen...instead the
confirmation dialog closes but the window is still there...
Code:
this is the codes we've got...

this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
if(JOptionPane.showConfirmDialog(container,
"Are you sure you want to leave the conference ?",
"iMessage: Quit Conference",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null) == JOptionPane.YES_OPTION) {
Message mymessage = new Message(CONFERENCE_LEAVE);
mymessage._destination = user.toString();
try {
frame.sendMessageToServer(mymessage);
}
catch(Exception se) {
System.out.println("Error sending message");
}
//setVisible(false);
//frame.removeFrame(user);
}




Re: java confirmation dialog

Fri Nov 07, 2008 12:47 pm

In this code as i see , the only thing will lead the man window to
close(not visiable only) is the commented lines of code :

//setVisible(false);
and u made a condition if for YES option and with no else ... so i
think setVisible false called in both before you comment it .
don't use setVisiable function to close window , use :
dispose()

Post a reply
  Related Posts  to : java confirmation dialog
 send confirmation link to email     -  
 Progress dialog     -  
 Show popup dialog using JQuery     -  
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 Java course     -  
 need help in java     -  
 What is Java API?!!!     -  
 java or .net     -  
 Using FTP in java     -  
 what is java     -