confirm exit netbeans desktop apps


do this..

        app.addExitListener(new ExitListener() {
            public boolean canExit(EventObject e) {
                return formWindowClosing();
            }
            public void willExit(EventObject e){
                
            }
        });

    ...

    private boolean formWindowClosing() {
        if(JOptionPane.showConfirmDialog(this.getFrame(), "Exit Application?", "Confirm Exit", JOptionPane.YES_NO_OPTION) ==
                JOptionPane.YES_OPTION){
            if (runner != null)
                if ( runner.isAlive())
                    runner.stopProcess();
            return true;

        }
        return false;
    }
   

And the world shines bright again..

  1. #1 by senny on April 25, 2010 - 12:17 pm

    hah? apaan itu? sejenis mantra biar dapet jodohkah?

  2. #2 by havban on May 5, 2010 - 5:39 am

    @senny🙂

    itu adalah jampi2 penolak jodoh.. huahuahua…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: