java - How do you prevent the main interface from closing, when you close others? -


i've spent last hour searching on google try , achieve - preventing closure of main interface after 1 of others closed. i'm not sure if correct way word question, apologies confusion if there any.

i have 1 interface called mainui, main interface starting java program. on interface 2 buttons opens 2 other interfaces (singleplayerstatsui , multipleplayerstatsui). if click on either button, opens appropriate interface (as should), when close opened interface closes main interface (mainui) - isn't want. wondering solution stop main interface closing (which main class of program)?

to save space in question, have java project on github (created in netbeans) @ https://github.com/rattfieldnz/java_projects/tree/master/pcricketstats. class file mainui called "mainui.java", class singleplayerstatsui called "singleplayerstatsui.java", , class multipleplayerstatsui called "multipleplayerstatsui.java". these classes located in https://github.com/rattfieldnz/java_projects/tree/master/pcricketstats/src/pcricketstats.

i have screenshots of each interface - these can seen @ http://imgur.com/a/gguid#0.

if question needs more clarification, please let me know.

change line 100 of singleplayerstatsui.java , line 88 of multipleplayerstatsui.java

setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); 

to

setdefaultcloseoperation(javax.swing.windowconstants.dispose_on_close); 

or change line 5 of singleplayerstatsui.form , multipleplayerstatsui.form

<property name="defaultcloseoperation" type="int" value="3"/> 

to

<property name="defaultcloseoperation" type="int" value="2"/> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -