I wrote this panel to display a column of buttons, and to make them all the same width.
I tried adding the panel to a frame using the borderlayout.CENTER method. But as I expected this stretches the buttons to fill the frame.
I would like to keep the buttons as a column all the same width, but wondered if to avoid the buttons becomming stretched, if there was any alternative to the jpanel? And I hoped to stop the buttons from stretching when the frame is maximised.
JPanel panel = new JPanel(new GridLayout(0,1));
panel.add(JButton button1 = new JButton("Ten"));
panel.add(JButton button2 = new JButton("Eleven"));
panel.add(JButton button3l = new JButton("Twelve"));
panel.add(JButton button4 = new JButton("Thirteen"));
panel.add(JButton button5 = new JButton("Fourteen"));