'How to make a vertical side menu, Jmenus in swing?

I'm relatively new to java swing, so I don't know to change the menu component in swing with a vertical one.



Solution 1:[1]

If you want a side menu with buttons, I imagine you probably want to use a JPanel with GridLayout. Something like:

JPanel p = new JPanel();
p.setLayout(new GridLayout(2,2));
Jlabel l = new JLabel("a");
p.add(l);
JButton btn = new JButton("click");
p.add (btn);
l = new JLabel("b");
p.add(l);
btn = new JButton("click");
p.add (btn);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1