java - JFrames painting over eachother -
i'm working jframes in java make gui. i'm having problem 2 jframes painting on eachother though.
public vidberggui() throws classnotfoundexception, instantiationexception, illegalaccessexception, unsupportedlookandfeelexception { super("automatic output verifier"); uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); setbounds(100, 100, 600, 400); setdefaultcloseoperation(jframe.exit_on_close); container con = this.getcontentpane(); con.add(titlepane); titlepane.setlayout(new boxlayout(titlepane, boxlayout.page_axis)); componentpane.setlayout(new boxlayout(componentpane, boxlayout.line_axis)); programsloaded = new jtable(data, columnnames) { @override public boolean iscelleditable(int row, int col) { if (col == 3) return false; return true; } }; programsloaded.getcolumnmodel().getcolumn(2).setcelleditor(new filechoosereditor()); tableholder = new jscrollpane(programsloaded); titlelabel.setfont(new font("ariel", font.bold, 28)); addbutton.setsize(40, 40); removebutton.setsize(40, 40); titlepane.add(titlelabel, borderlayout.page_start); con.add(componentpane); componentpane.add(tableholder, borderlayout.line_end); componentpane.add(addbutton, borderlayout.east); componentpane.add(removebutton, borderlayout.east); setvisible(true); // make frame visible }
with setup, componentpane visible. if comment out con.add(componentpane)
, titlepane visible. there way can assign sort of layout 2 frames stack vertically?
you understand borderlayout
can layout single component in each of it's 5 available slots? not...
create third jpanel
, add titlepane
, componentpane
, add center
position of borderlayout
you use gridlayout
or gridbaglayout
panel...
jpanel centerpane = new jpanel(new gridlayout(2, 1)); centerpane.add(titlepane); centerpane.add(componentpane); con.add(centerpane);
or add titlepane
north
position...
con.add(titlepane, borderlayout.north);
Comments
Post a Comment