This is my very first attempt working with Java so please go easy on me.
I have looked at the other JFrame
questions and I simply have not been able to find a working solution.
For some reason, I cannot get setPreferredSize
or setSize
to work.
The window continues to default to a different size. setMinimumSize
seems to work just fine. setMaximumSize
appears to be bugged from my reading.
Ultimately I am just trying to set the window to a specific non changeable size.
public LauncherFrame(@NonNull Launcher launcher) {
super(tr("launcher.title", launcher.getVersion()));
this.launcher = launcher;
instancesModel = new InstanceTableModel(launcher.getInstances());
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
initComponents();
setPreferredSize(new Dimension(900, 600));
setMinimumSize(new Dimension(600, 300));
setResizable(false);
pack();
setLocationRelativeTo(null);
SwingHelper.setFrameIcon(this, Launcher.class, "icon.png");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
loadInstances();
}
});
}
* UPDATE *
WOW ok... I am an idiot!!! The reason the sizing was not working was because the size was being set externally in another called file... Thank you everyone for the help. I have marked what would have been the correct answer.