java - show a new jframe on another jframe close event -
i have 2 jframes(assume , b) , when close 1 jframe(a) need show other jframe(b) have clue need override defaultclosingoperation have no idea how that.any appreciated .. thank all.
you can add windows listener frame.
windowlistener myexitlistener = new windowadapter() { @override public void windowclosing(windowevent e) { int confirmation = joptionpane.showoptiondialog(jframe1, "open frame2", "open frame2", joptionpane.yes_no_option, joptionpane.question_message, null, null, null); if (confirmation == 0) { //open jframe2 here } } }; jframe1.setdefaultcloseoperation(jframe.do_nothing_on_close); jframe1.addwindowlistener(myexitlistener);
Comments
Post a Comment