更新时间:2023-12-05 09:04:10
发生这种情况是因为您将标签添加到 JPanel
中,该标签使用 FlowLayout
并将间隙作为默认设置.要解决此问题,您可以在接下来使用:
That happens because you add labels to JPanel
which used FlowLayout
with gaps as default. To fix that you can use next:
JPanel line1 = new JPanel(new FlowLayout(FlowLayout.CENTER,0,0));
JPanel line2 = new JPanel(new BorderLayout());