Professional Documents
Culture Documents
Search
import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; public class AddingRemovingJMenu { public static void main(final String args[]) { JFrame frame = new JFrame("MenuSample Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar();
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
// File Menu, F - Mnemonic JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); menuBar.add(editMenu); menuBar.remove(0); menuBar.revalidate(); frame.setJMenuBar(menuBar); frame.setSize(350, 250); frame.setVisible(true); } }
Creating JMenuBar Components Adding Menus to and Removing Menus From Menu Bars Menu Accelerator
pdfcrowd.com
Vertical menu bar Shows how to right-align a menu in the menu bar, using a glue component Customize menu layout by changing the menu bar to use a top-tobottom box layout, and the popup menu to use a left-to-right box layout Customizing JMenuBar Look and Feel java2s.com | Contact Us | Privacy Policy Copyright 2009 - 12 Demo Source and Support. All rights reserved. All other trademarks are property of their respective owners.
pdfcrowd.com