GridBagLayout does not display a component
问题 I wrote a component to display a circular progressbar. When I put it in BorderLayout everything looks fine. But it can't be seen when a GridBagLayout is set. 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); I have no idea whether it is the problem of setting the GridBagConstraints or other reasons. 回答1: But it