【发布时间】:2012-06-11 08:58:40
【问题描述】:
所以我有 6 个面板,所有面板都使用网格布局。 我用gridbaglayout把它们放在一起,这是我想要的设计
结果一团糟 “第二个”面板变得离右边更远了 第三个面板向左挤压了很多,这是一场灾难。 这是我的网格包布局代码
c.gridx = 0; c.gridy = 0;
add (first,c);
c.gridx = 2; //so that the second panel starts from the center and is divided evenly with the first panel
add(second,c);
c.gridx = 0; c.gridy = 1;
add(third,c);
c.gridx = 1;
add(fourth,c);
c.gridx = 2;
add(fifth,c);
c.gridx = 3;
add(sixth,c);
感谢任何帮助。
【问题讨论】:
标签: java swing user-interface layout-manager gridbaglayout