在定位我的 JLabels 时,我发现了一个到目前为止我无法解决的问题。JLabels 重叠。
这是有关 gridbaglayout 的代码片段:
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 3;
c.fill = GridBagConstraints.HORIZONTAL;
c.ipady = 20;
c.weightx = 3;
c.weighty = 1;
c.insets = new Insets(0,5,5,5);
all.add(header, c);
c.gridx = 0;
c.gridy = 1;
c.weightx = 2;
c.weighty = 4;
c.insets = new Insets(5,5,5,5);
all.add(sts, c); //this label overlapped
c.gridx = 1;
c.gridy = 1;
c.weightx = 1;
c.weighty = 5;
c.insets = new Insets(5,5,5,5);
all.add(cl, c); //this label overlapped
提前致谢