0
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.Gridlayout没有设置约束
在代码中未显示的程序中,很可能存在其他程序错误。您将需要创建并发布[最小,可编译,可运行的示例程序](http://stackoverflow.com/help/mcve),以便我们告诉您为什么会遇到这种不正当行为。 –
编辑:你只添加了18个组件到你的中心JPanel,而不是24.如果你想要4列和可变数量的行,把GridLayout设置为'new GridLayout(0,4)'。 –
我会尝试做一个可变的行大小,应该完美地工作。谢谢 –