Box panel won't go vertical
This is on a JLayeredPane with many other components on it, but out in clear space on the right. I try making a JPanel with a BoxLayout and some buttons in it that will lay out vertically. So far, I haven't gotten it to happen. I have it trimmed down to the following code sample. The buttons and panel are being added to 'pane', which is a JLayeredPane. The buttons come out in a horizontal string (no matter what I have tried). I have tried
buttonPanel.validate(); and buttonPanel.setAlignmentX(Component.CENTER_ALIGNME NT);
and setSize() and setAlignmentX() on each of the buttons, to no avail. I would love to get these buttons to display vertically!
I have also tried PAGE_AXIS.
Cheers - Mark
JPanel buttonPanel = new JPanel();
BoxLayout boxLayout = new BoxLayout(buttonPanel, BoxLayout.Y_AXIS);
JButton hi = new JButton("Hi");
JButton hello = new JButton("Hello");
JButton howdy = new JButton("Howdy");