gpt4 book ai didi

java - 网格布局不按约束调整大小

转载 作者:行者123 更新时间:2023-12-01 13:27:57 25 4
gpt4 key购买 nike

    this.setSize(700,500);
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setIconImage(frameIcon.getImage());
this.setTitle("Rifle Reload Logger v1.0");
this.setMinimumSize(new Dimension(700,500));
/*
* The center panel of the JFrame will be used to display the current information
* as needed whether it be for showing the file chooser, or the reload data.*/
center.setVisible(true);
center.setLayout(new GridLayout(6,4));
this.add(center, BorderLayout.CENTER);
setGUILabels();//sets the labels for the entire Gui.

本质上我的问题是我的 GridLayout 没有创建我要求的 6x4 大小。它的尺寸为 6x3,这是一张图像。 Improper gridlayout.

最佳答案

您只向中心 JPanel 添加了 18 个组件,而不是 24 个。如果您需要 4 列和可变的行数,请将 GridLayout 设置为 new GridLayout(0, 4) .

关于java - 网格布局不按约束调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21709375/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com