List of usage examples for javax.swing JMenu JMenu
public JMenu(Action a)
Action
supplied. From source file:Main.java
public static void main(String[] argv) throws Exception { JMenu menu = new JMenu("Menu"); menu.setMnemonic('M'); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JMenu menu = new JMenu("Menu Label"); menu.add(new JMenuItem("Item Label")); boolean lwPopup = menu.getPopupMenu().isLightWeightPopupEnabled(); // true menu.getPopupMenu().setLightWeightPopupEnabled(false); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JMenu menu = new JMenu("Menu Label"); JMenuItem item1 = new JMenuItem("Item Label"); menu.add(item1);//from ww w.j a v a 2 s . co m // Add separator menu.add(new JSeparator()); // Add another menu item JMenuItem item2 = new JMenuItem("Item Label"); menu.add(item2); }
From source file:Main.java
License:asdf
public static void main(String[] argv) throws Exception { final JPopupMenu popupMenu = new JPopupMenu(); JMenu submenu = new JMenu("SubMenu1"); submenu.add("asdf"); submenu.add("asdf"); // Add submenu to popup menu popupMenu.add(submenu);/* ww w . j a v a 2 s. c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { // Create the menu bar JMenuBar menuBar = new JMenuBar(); // Create a menu JMenu menu = new JMenu("Menu Label"); menuBar.add(menu);/*from w w w . ja v a 2s . c om*/ // Create a menu item JMenuItem item = new JMenuItem("Item Label"); //item.addActionListener(actionListener); menu.add(item); JFrame frame = new JFrame(); // Install the menu bar in the frame frame.setJMenuBar(menuBar); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Menu Bar Demo"); JMenuBar bar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); JMenu helpMenu = new JMenu("Help"); bar.add(fileMenu);//from w w w.j ava2 s. c om bar.add(editMenu); bar.add(helpMenu); frame.setSize(300, 150); frame.setJMenuBar(bar); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); // File Menu, F - Mnemonic JMenu fileMenu = new JMenu("File"); fileMenu.setDelay(100);//from www. ja v a2 s .c o m // File->New, N - Mnemonic JMenuItem newMenuItem = new JMenuItem("New"); fileMenu.add(newMenuItem); frame.setJMenuBar(menuBar); frame.setSize(350, 250); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); // File Menu, F - Mnemonic JMenu fileMenu = new JMenu("File"); fileMenu.setMenuLocation(10, 10);// w w w . j a va2 s . c o m // File->New, N - Mnemonic JMenuItem newMenuItem = new JMenuItem("New"); fileMenu.add(newMenuItem); frame.setJMenuBar(menuBar); frame.setSize(350, 250); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); // File Menu, F - Mnemonic JMenu fileMenu = new JMenu("File"); // File->New, N - Mnemonic JMenuItem newMenuItem = new JMenuItem("New"); fileMenu.add(newMenuItem);// w w w.j av a2 s . c o m frame.setJMenuBar(menuBar); frame.setSize(350, 250); frame.setVisible(true); fileMenu.setSelected(true); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); // File Menu, F - Mnemonic JMenu fileMenu = new JMenu("File"); // File->New, N - Mnemonic JMenuItem newMenuItem = new JMenuItem("New"); fileMenu.add(newMenuItem);/*from w w w . j av a 2s. com*/ frame.setJMenuBar(menuBar); frame.setSize(350, 250); frame.setVisible(true); fileMenu.setPopupMenuVisible(true); }