java - Why isn't my GUI displaying? -


i'm using intelij write file transfer program , i'm working on gui right using swing. i've made plenty of programs in swing, reason can't figure out why gui isn't showing when run program. compiles fine.

    public class stage  {      jpanel maincontainer = new jpanel();     jpanel window = new jpanel();     jbutton loadbutton = new jbutton();     jbutton savebutton = new jbutton();     jtextpane cmdout = new jtextpane();     jmenubar menubar = new jmenubar();     jmenu menu = new jmenu();     jmenuitem exitbutton = new jmenuitem("exit");  public void display(){     maincontainer.setvisible(true);     maincontainer.add(window);     maincontainer.add(menubar);     menubar.add(menu);     menu.add(exitbutton);     window.setlayout(new gridbaglayout());     window.add(loadbutton);     window.add(savebutton);     window.add(cmdout);     cmdout.settext("test");     window.setvisible(true);    }   } 

here main method in class.

public static void main(string[] args) throws ioexception {     stage stage = new stage();      stage.display();     } 

why don't put main panel jframe, jframe contain main panel, , main panel hold else?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -