所以我有 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);
任何帮助表示赞赏。