Java Swing How to - Create Submenu on the Main menu
Java Swing How to - Create Submenu on the Main menu Menus are unique in that, by convention, they aren't placed with the other components in the UI. Instead, a menu usually appears either in a menu bar or as a popup menu . A menu bar contains one or more menus and has a customary, platform-dependent location — usually along the top of a window. A popup menu is a menu that is invisible until the user makes a platform-specific mouse action, such as pressing the right mouse button, over a popup-enabled component. The popup menu then appears under the cursor. import javax.swing.*; import java.awt.event.KeyEvent; public class SubMenuExample { public static void main( final String args[]) { JFrame frame = new JFrame( "MenuSample Example" ); frame.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE ); JMenuBar menuBar = new JMenuBar(); // File Menu, F - Mnemonic JMenu fileMenu = new JMenu( "File" ); fileMenu.setMnemon...