我写了一个组件来显示一个圆形进度条。当我把它放进去时,BorderLayout一切看起来都很好。

但是设置 a 时就看不到了GridBagLayout。

p.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
p.add(north(), gbc);
gbc.gridx = 0;
gbc.gridy = 1;
p.add(west(), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
p.add(bar, gbc);
我不知道是设置的问题GridBagConstraints还是其他原因。