Package javax.swing

Examples of javax.swing.JMenuBar


            });
           
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
           
            // make menus
            JMenuBar mainMenu = new JMenuBar();
            setJMenuBar(mainMenu);
            for (JMenu menu: menues) mainMenu.add(menu);
           
            pack();
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here


    addHomeListener(home);
    addLanguageListener(preferences);
    addPlanControllerListener(controller.getPlanController());
    addFocusListener();
    updateFocusTraversalPolicy();
    JMenuBar homeMenuBar = createMenuBar(home, preferences, controller);
    setJMenuBar(homeMenuBar);
    Container contentPane = getContentPane();
    contentPane.add(createToolBar(home), BorderLayout.NORTH);
    contentPane.add(createMainPane(home, preferences, controller));
    if (OperatingSystem.isMacOSXLeopardOrSuperior()) {
View Full Code Here

    if (!OperatingSystem.isMacOSX()) {
      addActionToMenu(ActionType.ABOUT, helpMenu);     
    }
   
    // Add menus to menu bar
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(furnitureMenu);
    if (controller.getPlanController().getView() != null) {
      menuBar.add(planMenu);
    }
    if (controller.getHomeController3D().getView() != null) {
      menuBar.add(preview3DMenu);
    }
    menuBar.add(helpMenu);

    // Add plugin actions menu items
    for (Action pluginAction : this.pluginActions) {
      String pluginMenu = (String)pluginAction.getValue(PluginAction.Property.MENU.name());
      if (pluginMenu != null) {
        boolean pluginActionAdded = false;
        for (int i = 0; i < menuBar.getMenuCount(); i++) {
          JMenu menu = menuBar.getMenu(i);
          if (menu.getText().equals(pluginMenu)) {
            // Add menu item to existing menu
            menu.addSeparator();
            menu.add(new ResourceAction.MenuItemAction(pluginAction));
            pluginActionAdded = true;
            break;
          }
        }
        if (!pluginActionAdded) {
          // Create missing menu before last menu
          JMenu menu = new JMenu(pluginMenu);
          menu.add(new ResourceAction.MenuItemAction(pluginAction));
          menuBar.add(menu, menuBar.getMenuCount() - 1);
        }
      }
    }

    // Add EXIT action at end to ensure it's the last item of file menu
View Full Code Here

        if (fMain instanceof java.awt.Window) {
            ((java.awt.Window) fMain).addWindowListener(this);
        }

        JMenuBar bar = new JMenuBar();

        // used shortcuts: CERGTSIUDOLM
        String[] fitems = {
            "-Connect...", "--", "OOpen Script...", "-Save Script...",
            "-Save Result...", "--", "-Exit"
        };

        jmenu = addMenu(bar, "File", fitems);

        // All actions after Connect and the divider are local.
        for (int i = 2; i < jmenu.getItemCount(); i++) {
            mitem = jmenu.getItem(i);

            if (mitem != null) {
                localActionList.add(mitem);
            }
        }

        Object[] vitems = {
            "RRefresh Tree", boxAutoRefresh, "--", boxRowCounts, boxShowSys,
            boxShowSchemas, boxShowGrid
        };

        addMenu(bar, "View", vitems);

        String[] sitems = {
            "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "EEXECUTE", "---",
            "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX",
            "--", "CCOMMIT*", "LROLLBACK*", "-CHECKPOINT*", "-SCRIPT", "-SET",
            "-SHUTDOWN", "--", "-Test Script"
        };

        addMenu(bar, "Command", sitems);

        mRecent = new JMenu("Recent");

        mRecent.setMnemonic(KeyEvent.VK_R);
        bar.add(mRecent);

        ButtonGroup lfGroup = new ButtonGroup();

        lfGroup.add(rbNativeLF);
        lfGroup.add(rbJavaLF);
        lfGroup.add(rbMotifLF);
        boxShowSchemas.setSelected(showSchemas);
        boxShowGrid.setSelected(gridFormat);
        boxTooltips.setSelected(showTooltips);
        boxShowGrid.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G,
                Event.CTRL_MASK));
        boxAutoRefresh.setSelected(autoRefresh);
        boxRowCounts.setSelected(displayRowCounts);
        boxShowSys.setSelected(showSys);
        rbNativeLF.setActionCommand("LFMODE:" + CommonSwing.Native);
        rbJavaLF.setActionCommand("LFMODE:" + CommonSwing.Java);
        rbMotifLF.setActionCommand("LFMODE:" + CommonSwing.Motif);
        tipMap.put(mitemUpdateSchemas, "Refresh the schema list in this menu");
        tipMap.put(rbAllSchemas, "Display items in all schemas");
        tipMap.put(mitemAbout, "Display product information");
        tipMap.put(mitemHelp, "Display advice for obtaining help");
        tipMap.put(boxAutoRefresh,
                   "Refresh tree (and schema list) automatically"
                   + "when YOU modify database objects");
        tipMap.put(boxShowSchemas,
                   "Display object names in tree-like schemaname.basename");
        tipMap.put(rbNativeLF,
                   "Set Look and Feel to Native for your platform");
        tipMap.put(rbJavaLF, "Set Look and Feel to Java");
        tipMap.put(rbMotifLF, "Set Look and Feel to Motif");
        boxTooltips.setToolTipText("Display tooltips (hover text), like this");
        tipMap.put(boxAutoCommit,
                   "Shows current Auto-commit mode.  Click to change");
        tipMap.put(
            boxLogging,
            "Shows current JDBC DriverManager logging mode.  Click to change");
        tipMap.put(boxShowSys, "Show system tables in table tree to the left");
        tipMap.put(boxShowGrid, "Show query results in grid (in text if off)");
        tipMap.put(boxRowCounts, "Show row counts with table names in tree");
        boxAutoRefresh.setMnemonic(KeyEvent.VK_C);
        boxShowSchemas.setMnemonic(KeyEvent.VK_Y);
        boxAutoCommit.setMnemonic(KeyEvent.VK_A);
        boxShowSys.setMnemonic(KeyEvent.VK_Y);
        boxShowGrid.setMnemonic(KeyEvent.VK_G);
        boxRowCounts.setMnemonic(KeyEvent.VK_C);
        boxLogging.setMnemonic(KeyEvent.VK_L);
        rbAllSchemas.setMnemonic(KeyEvent.VK_ASTERISK);
        rbNativeLF.setMnemonic(KeyEvent.VK_N);
        rbJavaLF.setMnemonic(KeyEvent.VK_J);
        rbMotifLF.setMnemonic(KeyEvent.VK_M);
        mitemUpdateSchemas.setMnemonic(KeyEvent.VK_U);

        Object[] soptions = {

            // Added: (weconsultants@users) New menu options
            rbNativeLF, rbJavaLF, rbMotifLF, "--", "-Set Fonts", "--",
            boxAutoCommit, "--", "-Disable MaxRows", "-Set MaxRows to 100",
            "--", boxLogging, "--", "-Insert test data"
        };

        addMenu(bar, "Options", soptions);

        String[] stools = {
            "-Dump", "-Restore", "-Transfer"
        };

        jmenu = addMenu(bar, "Tools", stools);

        jmenu.setEnabled(TT_AVAILABLE);
        localActionList.add(jmenu);

        for (int i = 0; i < jmenu.getItemCount(); i++) {
            mitem = jmenu.getItem(i);

            if (mitem != null) {
                localActionList.add(mitem);
            }
        }

        mnuSchemas.setMnemonic(KeyEvent.VK_S);
        bar.add(mnuSchemas);

        JMenu mnuHelp = new JMenu("Help");

        mnuHelp.setMnemonic(KeyEvent.VK_H);
        mnuHelp.add(mitemAbout);
        mnuHelp.add(mitemHelp);
        mnuHelp.add(boxTooltips);
        rbAllSchemas.addActionListener(schemaListListener);

        // May be illegal:
        mitemUpdateSchemas.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {
                updateSchemaList();
            }
        });
        mitemHelp.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {

                JOptionPane.showMessageDialog(fMain.getContentPane(),
                                              HELP_TEXT, "HELP",
                                              JOptionPane.INFORMATION_MESSAGE);
            }
        });
        mitemAbout.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {

                JOptionPane.showMessageDialog(fMain.getContentPane(),
                                              ABOUT_TEXT, "About",
                                              JOptionPane.INFORMATION_MESSAGE);
            }
        });
        boxTooltips.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionevent) {

                showTooltips = boxTooltips.isSelected();

                resetTooltips();
            }
        });
        bar.add(mnuHelp);

        if (fMain instanceof JApplet) {
            ((JApplet) fMain).setJMenuBar(bar);
        } else if (fMain instanceof JFrame) {
            ((JFrame) fMain).setJMenuBar(bar);
View Full Code Here

  public Point getLocationOnScreen() {
    Point contentPaneLocation = getContentPaneInternal().getLocationOnScreen();
    int x = contentPaneLocation.x;
    int y = contentPaneLocation.y;
    JMenuBar menuBar = getJMenuBarInternal();
    if (menuBar != null) {
      y -= menuBar.getHeight();
    }
    return new Point(x, y);
  }
View Full Code Here

                frame.getContentPane().setLayout(new BorderLayout());

                BrowserComponentManager manager = BrowserComponentManager.create(frame);
                frame.setContentPane(manager.getComponent());
               
                JMenuBar mainMenu = createMainMenu(manager);
                frame.setJMenuBar(mainMenu);

                manager.open(null);

                DBBrowserConfig.loadWindowSize("main", frame);
View Full Code Here

            }
        });
    }

    private static JMenuBar createMainMenu(BrowserComponentManager manager) {
        JMenuBar mainMenu = new JMenuBar();
       
        JMenu fileMenu = new JMenu("File");
        fileMenu.setMnemonic('F');
        JMenuItem openItem = fileMenu.add(new OpenAction(manager));
        openItem.setAccelerator(KeyStroke.getKeyStroke("control O"));
        openItem.setMnemonic('O');
        JMenu recentMenu = new JMenu("Open Recent");
        recentMenu.addMenuListener(new RecentMenu(manager, recentMenu));
        JMenuItem recentItem = fileMenu.add(recentMenu);       
        recentItem.setMnemonic('R');
       
        JMenuItem closeItem = fileMenu.add(new CloseAction(manager));
        closeItem.setMnemonic('C');
        fileMenu.add(new JSeparator());
        JMenuItem exitItem = fileMenu.add(new ExitAction(manager));
        exitItem.setAccelerator(KeyStroke.getKeyStroke("alt X"));
        exitItem.setMnemonic('x');
       
        JMenu helpMenu = new JMenu("Help");
        helpMenu.setMnemonic('H');
        JMenuItem aboutItem = helpMenu.add(new AboutAction(manager));
        aboutItem.setMnemonic('A');
       
        mainMenu.add(fileMenu);
        mainMenu.add(helpMenu);
        return mainMenu;
    }
View Full Code Here

  }

  int divloc = 0;

  JMenuBar makeMenuBar() {
    return new JMenuBar() {
        {
          add(makeFileMenu());
          add(editMenu = makeEditMenu());
          add(makeBundleMenu());
          add(viewMenu = makeViewMenu(null));
View Full Code Here

   *  
   * @return javax.swing.JMenuBar 
   */
  private JMenuBar getJJMenuBar() {
    if (jJMenuBar == null) {
      jJMenuBar = new JMenuBar();
      jJMenuBar.add(getFileMenu());
      jJMenuBar.add(getHelpMenu());
    }
    return jJMenuBar;
  }
View Full Code Here

      setExtendedState(JFrame.MAXIMIZED_BOTH);
      setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

      pagePreview.addMouseWheelListener(new MouseWheelZoomListener(pagePreview));
     
      JMenuBar menuBar = new JMenuBar();
      JMenu menuFile = new JMenu();
      menuFile.setText(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "File"));
      menuFile.setMnemonic(KeyEvent.VK_F);

      JMenuItem saveAsItem = new JMenuItem();
      saveAsItem.setAction(new SaveImageAction(pagePreview, this));

      JMenuItem closeItem = new JMenuItem();
      closeItem.setAction(new HideFrameAction(this));

      JMenu menuImage = new JMenu();
      menuImage.setText(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Image"));
      menuImage.setMnemonic(KeyEvent.VK_I);

      // zoom
      JMenuItem zoomInItem = new JMenuItem();
      ZoomInImageAction zoomIn = new ZoomInImageAction(pagePreview);
      ZoomOutImageAction zoomOut = new ZoomOutImageAction(pagePreview);
      ZoomResetImageAction zoomReset = new ZoomResetImageAction(pagePreview);
      zoomInItem.setAction(zoomIn);
      JMenuItem zoomOutItem = new JMenuItem();
      zoomOutItem.setAction(zoomOut);
      JMenuItem zoomNone = new JMenuItem();
      zoomNone.setAction(zoomReset);

      // rotate
      JMenuItem rotateRight = new JMenuItem();
      RotateRightImageAction rotateRightAction = new RotateRightImageAction(pagePreview);
      RotateLeftImageAction rotateLeftAction = new RotateLeftImageAction(pagePreview);
      rotateRight.setAction(rotateRightAction);
      JMenuItem rotateLeft = new JMenuItem();
      rotateLeft.setAction(rotateLeftAction);

      menuFile.add(saveAsItem);
      menuFile.add(closeItem);
      menuBar.add(menuFile);
      menuImage.add(zoomInItem);
      menuImage.add(zoomOutItem);
      menuImage.add(zoomNone);
      menuImage.addSeparator();
      menuImage.add(rotateRight);
      menuImage.add(rotateLeft);
      menuBar.add(menuImage);
      getRootPane().setJMenuBar(menuBar);

      JToolBar toolBar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
      toolBar.setFloatable(true);
      toolBar.setRollover(true);
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.