我有一个主框架和 3 个面板。我想将这 3 个面板添加到主框架中。但是,其中只有 2 个被添加。第三个不是。我不知道为什么。有人可以帮忙吗?
setLayout(new GridBagLayout());
GridBagConstraints gbc=new GridBagConstraints();
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbc.gridheight=GridBagConstraints.RELATIVE;
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.fill=GridBagConstraints.BOTH;
gbc.weightx=gbc.weighty=1;
add(topPanel1, gbc);
add(bottomPanel1, gbc);
gbc.gridheight=GridBagConstraints.REMAINDER;
add(buttonsPanel, gbc);
上面的代码是一个框架的构造函数。