I've attempted 3-5 different means of putting buttons/components into this JPanel, but I have so far failed to find how to resize the individual entries because the panel sizes them itself.
I feel as though I have some fundamental misunderstanding of the Panel; I'll attach an example.
Here is where I struggle:
private JPanel makeButtonsPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(7, 0));
JButton settings = new JButton("Settings");
settings.setPreferredSize(new Dimension(100, 50)); // <---
panel.add(settings, BorderLayout.CENTER);
return panel;
}
public ThisPage() {
JFrame landing_frame = new JFrame();
landing_frame.setPreferredSize( new Dimension(1920, 1080) ); //temporary sizes
JPanel landing_panel = new JPanel();
landing_panel.setLayout(new GridLayout(0, 3));
landing_panel.add( makeButtonsPanel(), 0.0f ); // <---
landing_frame.add(landing_panel, BorderLayout.CENTER);
landing_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
landing_frame.setTitle("PLO");
landing_frame.pack();
landing_frame.setVisible(true);
}
It may be that JPanel is the wrong tool for having customized sizes for items, maybe I'm just using the wrong LayoutManager for this?
I did see the post "JButton Sizing Not Working," but I've attempted both solutions presented there (but may have done at least one wrong).
This is my first experience with JFrames; any help would be appreciated.