Package javax.swing

Examples of javax.swing.JMenuBar


   
   public void createControlButtons() {
   }
  
    public JMenuBar createMenuBar() {
        JMenuBar menuBar = new JMenuBar();

        //Set up the lone menu.
        JMenu menu = new JMenu("Actions");
        menu.setMnemonic(KeyEvent.VK_M);
        menuBar.add(menu);


        JMenuItem menuItem = new JMenuItem("PrologConsole");
        menuItem.setMnemonic(KeyEvent.VK_P);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(
View Full Code Here


        JPanel p = null;
        try {
            // Create the menu
            MenuFactory mf = new MenuFactory(bundle, this);
            JMenuBar mb = mf.createJMenuBar("MenuBar");
            setJMenuBar(mb);

            localHistory = new LocalHistory(mb, this);

            String uri[] = application.getVisitedURIs();
View Full Code Here

  private final JPanel findPanel;

  ChainsawToolBarAndMenus(final LogUI logui) {
    this.logui = logui;
    toolbar = new JToolBar(JToolBar.HORIZONTAL);
    menuBar = new JMenuBar();
    fileMenu = new FileMenu(logui);
    closeAction = createCloseHelpAction();
    changeModelAction = createChangeModelAction();
    findField = new JTextField();
    findNextAction = getFindNextAction();
View Full Code Here

    /**
     * Creates a new menubar to be shown in this window.
     * @return the newly created menubar
     */
    private JMenuBar setupMenu() {
        JMenuBar menuBar = new JMenuBar();
        JMenu menu = new JMenu(translator.getString("Menu.File"));
        menu.setMnemonic(KeyEvent.VK_F);
        //Adds mostly the same actions, but without icons
        menu.add(new Command(translator.getString("Menu.Print"), KeyEvent.VK_P) {
            public void doit() {
                startPrinterJob(true);
            }
        });
        // inputHandler must be set to allow reloading
        if (renderable != null) {
            menu.add(new Command(translator.getString("Menu.Reload"), KeyEvent.VK_R) {
                public void doit() {
                    reload();
                }
            });
        }
        menu.addSeparator();
        menu.add(new Command(translator.getString("Menu.Exit"), KeyEvent.VK_X) {
            public void doit() {
                dispose();
            }
        });
        menuBar.add(menu);

        menu = new JMenu(translator.getString("Menu.View"));
        menu.setMnemonic(KeyEvent.VK_V);
        menu.add(new Command(translator.getString("Menu.First.page"), KeyEvent.VK_F) {
            public void doit() {
                goToFirstPage();
            }
        });
        menu.add(new Command(translator.getString("Menu.Prev.page"), KeyEvent.VK_P) {
            public void doit() {
                goToPreviousPage();
            }
        });
        menu.add(new Command(translator.getString("Menu.Next.page"), KeyEvent.VK_N) {
            public void doit() {
                goToNextPage();
            }
        });
        menu.add(new Command(translator.getString("Menu.Last.page"), KeyEvent.VK_L) {
            public void doit() {
                goToLastPage();
            }
        });
        menu.add(new Command(translator.getString("Menu.Go.to.Page"), KeyEvent.VK_G) {
            public void doit() {
                showGoToPageDialog();
            }
        });
        menu.addSeparator();
        JMenu subMenu = new JMenu(translator.getString("Menu.Zoom"));
        subMenu.setMnemonic(KeyEvent.VK_Z);
        subMenu.add(new Command("25%", 0) {
            public void doit() {
                setScale(25.0);
            }
        });
        subMenu.add(new Command("50%", 0) {
            public void doit() {
                setScale(50.0);
            }
        });
        subMenu.add(new Command("75%", 0) {
            public void doit() {
                setScale(75.0);
            }
        });
        subMenu.add(new Command("100%", 0) {
            public void doit() {
                setScale(100.0);
            }
        });
        subMenu.add(new Command("150%", 0) {
            public void doit() {
                setScale(150.0);
            }
        });
        subMenu.add(new Command("200%", 0) {
            public void doit() {
                setScale(200.0);
            }
        });
        menu.add(subMenu);
        menu.addSeparator();
        menu.add(new Command(translator.getString("Menu.Default.zoom"), KeyEvent.VK_D) {
            public void doit() {
                setScale(100.0);
            }
        });
        menu.add(new Command(translator.getString("Menu.Fit.Window"), KeyEvent.VK_F) {
            public void doit() {
                setScaleToFitWindow();
            }
        });
        menu.add(new Command(translator.getString("Menu.Fit.Width"), KeyEvent.VK_W) {
            public void doit() {
                setScaleToFitWidth();
            }
        });
        menu.addSeparator();

        ButtonGroup group = new ButtonGroup();
        JRadioButtonMenuItem single = new JRadioButtonMenuItem(
                new Command(translator.getString("Menu.Single"), KeyEvent.VK_S) {
            public void doit() {
                previewPanel.setDisplayMode(PreviewPanel.SINGLE);
            }
        });
        JRadioButtonMenuItem cont = new JRadioButtonMenuItem(
                new Command(translator.getString("Menu.Continuous"), KeyEvent.VK_C) {
            public void doit() {
                previewPanel.setDisplayMode(PreviewPanel.CONTINUOUS);
            }
        });
        JRadioButtonMenuItem facing = new JRadioButtonMenuItem(
                new Command(translator.getString("Menu.Facing"), 0) {
            public void doit() {
                previewPanel.setDisplayMode(PreviewPanel.CONT_FACING);
            }
        });
        single.setSelected(true);
        group.add(single);
        group.add(cont);
        group.add(facing);
        menu.add(single);
        menu.add(cont);
        menu.add(facing);

        menuBar.add(menu);

        menu = new JMenu(translator.getString("Menu.Help"));
        menu.setMnemonic(KeyEvent.VK_H);
        menu.add(new Command(translator.getString("Menu.About"), KeyEvent.VK_A) {
            public void doit() {
                startHelpAbout();
            }
        });
        menuBar.add(menu);
        return menuBar;
    }
View Full Code Here

                });
               
                JMenu menu = new JMenu("File");
                menu.add(screenshot);
                menu.add(exit);
                JMenuBar mb = new JMenuBar();
                mb.add(menu);
                frame.setJMenuBar(mb);

                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
View Full Code Here

        JPanel p = null;
        try {
            // Create the menu
            MenuFactory mf = new MenuFactory(bundle, this);
            JMenuBar mb = mf.createJMenuBar("MenuBar");
            setJMenuBar(mb);

            localHistory = new LocalHistory(mb, this);

            String uri[] = application.getVisitedURIs();
View Full Code Here

    }
  }
 
  private void setupMenu() {
    //Create the menu bar.
    JMenuBar menuBar = new JMenuBar();

    //Build the first menu.
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_A);
    menuBar.add(fileMenu);
   
    JMenu newMenu = new JMenu("New");
    newMenu.setMnemonic(KeyEvent.VK_N);
   
    JMenuItem newScriptItem = new JMenuItem("R Script");
View Full Code Here

      // com.apple.eawt.Application.setDefaultMenuBar(JMenuBar)     
      Class<?> appClass = Application.class;
      Method method =
        appClass.getMethod("setDefaultMenuBar", new Class[] { JMenuBar.class });
      if (method != null) {
        JMenuBar defaultMenuBar = new JMenuBar();
        JMenu fileMenu = base.buildFileMenu(null);
        defaultMenuBar.add(fileMenu);
        method.invoke(application, new Object[] { defaultMenuBar });
        // This is kind of a gross way to do this, but the alternatives? Hrm.
        Base.defaultFileMenu = fileMenu;
      }
    } catch (Exception e) {
View Full Code Here

            if (base.isShowing()) {
                Window w = base.getAWTComponent();
                if (w instanceof Frame) {
                    MenuBar mb = ((Frame) w).getMenuBar();
                    if (mb != null) {
                        JMenuBar jmb = ((SwingMenuBarPeer) mb.getPeer()).jComponent;
                        Point p = new Point(x, y);
                        SwingUtilities.convertPointFromScreen(p, jmb);
                        comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y);
                        if (comp != null && (comp != jmb || jmb.contains(p.x, p.y))) {
                            return comp;
                        }
                    }
                }
                Point p = new Point(x, y);
View Full Code Here

final class SwingMenuBarPeer extends SwingMenuComponentPeer<MenuBar, JMenuBar>
    implements MenuBarPeer {

    @SuppressWarnings("deprecation")
    public SwingMenuBarPeer(SwingToolkit toolkit, MenuBar menuBar) {
        super(toolkit, menuBar, new JMenuBar());
        int mc = menuBar.getMenuCount();


        Menu help_menu = menuBar.getHelpMenu();
        if (help_menu != null) {
View Full Code Here

TOP

Related Classes of javax.swing.JMenuBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.