Sunday, 15 August 2010

Java Swing resizing UI overlap elements -



Java Swing resizing UI overlap elements -

i have created gui netbeans gui builder , manually wrote additional code. don't know how describe problem, please have @ image below.

this default view, can notice jtable has been created within jpanel manually:

jpanel1.setlayout(new borderlayout()); tablemodel model = db.populatejtable(); jtable jtable1 = new jtable(model); jtable1.setmodel(model); jscrollpane tablecontainer = new jscrollpane(jtable1); jpanel1.add(tablecontainer); view.super.getcontentpane().add(jpanel1); //view.super.pack(); view.super.setvisible(true);

when seek resize window horizontally, components react resizing specified, jtable remain rendered before, overlapping other elements:

can please tell me happening , how should proceed? many thanks

a powerful solution: utilize layouts. job while resizing.

a 1 gridbaglayout. if need more complex layout, can utilize powerful boxlayout

that if want design layout manually. me, prefer using netbeans 7.2.1 designer. automatically configures layout while designing them in design window.

java swing jtable jframe jpanel

No comments:

Post a Comment