java - Closing Jform in the constructor -
i having minor issue code. want jform not displayed if condition not met in constructor portion of form.outside constructor dispose(), return , setvisible(false) work fine. have tried this.dispose(); , return; , this.setvisible(false); form still displayed. system.exit(0); closes complete app. appreciate if can me this.
public class ordergui extends javax.swing.jframe { public ordergui(customer cust, date dt, time t) throws filenotfoundexception, ioexception, classnotfoundexception { this(); if(condition) { /////do not initialize jform }else{//// run rest of code} }
do this
public class ordergui extends javax.swing.jframe { public ordergui(customer cust, date dt, time t) throws filenotfoundexception, ioexception, classnotfoundexception { this(); } @override public void setvisible(boolean val){ if(!condition){ super.setvisible(val); } } }
Comments
Post a Comment