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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -