public myDialog(){
..
this.addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
this_windowClosing(e);
}
});
}
void this_windowClosing(WindowEvent e){
DefaultCommand userCloseFrameCommand = new DefaultCommand();
this.getMainProcess().addCommand(userCloseFrameCommand);
{
this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
int returnValue = JOptionPane.showConfirmDialog(MyClass.this,"Wollen sie das Programm wirklich beenden?");
if (returnValue == 0)
{
MyClass.this.setVisible(false);
System.exit(0);
}
}
});