i try table on bottom screen. first added 2 table on root table. every table has 4 cells.
code. how can this. code not work.
table table = new table(); table.bottom(); table.setfillparent(true); table table1 = new table(); table1.setfillparent(true); table table2 = new table(); table2.setfillparent(true); . . . table2.add(image1).size(image1.getwidth(), image1.getheight()); table3.add(image2).size(image2.getwidth(), image2.getheight()); table3.add(image3).size(image3.getwidth(), image3.getheight()); table3.add(image4).size(image4.getwidth(), image4.getheight()); table3.add(image5).size(image5.getwidth(), image5.getheight()); table2.add(table3); table2.row(); table2.add(image6).size(image6.getwidth(), image6.getheight()); table2.add(image7).size(image7.getwidth(), image7.getheight()); table2.add(image8).size(image8.getwidth(), image8.getheight()); table2.add(); table1.add(table2); table.add(table1).expandx(); table5.add(image9).size(image9.getwidth(), image9.getheight()); table6.add(image10).size(image10.getwidth(), image10.getheight()); table6.add(image11).size(image11.getwidth(), image11.getheight()); table6.add(image12).size(image12.getwidth(), image12.getheight()); table6.add(image13).size(image13.getwidth(), image13.getheight()); table5.add(table6); table5.row(); table5.add(image6).size(image6.getwidth(), image6.getheight()); table5.add(image7).size(image7.getwidth(), image7.getheight()); table5.add(image8).size(image8.getwidth(), image8.getheight()); table5.add(); table4.add(table5); table.add(table4).expandx();
for each of 2 root tables, make 4x2 table, first cell spans 3 columns, , second cell contains 1 inner table 4 cells.
i use helper methods possible cut down on redundancy make easier tweak. try starting (untested):
private static cell addsizedimage(table table, image image){ return table.add(image).size(image.getwidth(), image.getheight()); } private static table generateblock (image... imgs){ if (imgs.length != 8) throw new unsupportedoperationexception("must have 8 images"); table root = new table(); addsizedimage(root, imgs[0]).colspan(3); table innertable = new table(); addsizedimage(innertable, imgs[1]); addsizedimage(innertable, imgs[2]).row(); addsizedimage(innertable, imgs[3]); addsizedimage(innertable, imgs[4]); root.add(innertable).row(); addsizedimage(root, imgs[5]); addsizedimage(root, imgs[6]); addsizedimage(root, imgs[7]); return root; } private table createimagesui (){ table root = new table(); root.setfillparent(true); root.bottom(); root.add(generateblock(image1, image2, image3, image4, image5, image6, image7, image8)).expandx(); root.add(generateblock(image9, image10, image11, image12, image13, image14, image15, image16)).expandx(); return root; }
Comments
Post a Comment