开发者

Java: submenu in jpopupmenu with separators and shortcut keys that appear?

开发者 https://www.devze.com 2023-03-22 10:43 出处:网络
how do you go about adding submenu\'s to an existing jpopupmenu? when you right click the j开发者_StackOverflow社区popupmenu appears, I want to access submenus under another menu.

how do you go about adding submenu's to an existing jpopupmenu?

when you right click the j开发者_StackOverflow社区popupmenu appears, I want to access submenus under another menu.

how do you add separators in the jpopupmenu? what about shortcut keys?

Below image describes what I want.

Java: submenu in jpopupmenu with separators and shortcut keys that appear?


For separators, you will need JSeparator, see example here.

For binding a shortcut, you will need to call setMnemonic, see example here.

For sub-menu, simply add a JMenu to an existing JMenu/JPopupMenu as a child, see example here.

Note: links 4-6 are the same one


Read the section from the Swing tutorial on How to Use Menus for working examples and explanations.

0

精彩评论

暂无评论...
验证码 换一张
取 消