Question

How to add a menuItem inside/sub of another menuItem in Java? is it possible ?

Was it helpful?

Solution

Try the following

submenu1 = new JMenu("my submenu");
JMenuItem menuItem1 = new JMenuItem("submenu items");

submenu1.add(menuItem1);

menuItem1 = new JMenuItem("item1");
submenu1.add(menuItem1);

Refer to this example for more details.

OTHER TIPS

Add JMenu instead of the first JMenuItem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top