Example usage for javax.swing JMenu addSeparator

List of usage examples for javax.swing JMenu addSeparator

Introduction

In this page you can find the example usage for javax.swing JMenu addSeparator.

Prototype

public void addSeparator() 

Source Link

Document

Appends a new separator to the end of the menu.

Usage

From source file:com.apatar.ui.Actions.java

private void createMenubar() {

    menubar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");
    fileMenu.add(newPrj);//from w w  w . ja  v  a 2s  . c  o m

    fileMenu.add(open);
    fileMenu.addSeparator();
    fileMenu.add(save);
    fileMenu.add(saveAs);
    fileMenu.addSeparator();
    // fileMenu.add(publishToApatar);@@
    // fileMenu.add(runScheduling);@@
    // fileMenu.addSeparator();@@
    fileMenu.add(run);
    // fileMenu.addSeparator();
    // apon
    // fileMenu.add(newWebService);@@
    // fileMenu.addSeparator();@@

    // fileMenu.add(options);@@
    // fileMenu.addSeparator();@@
    fileMenu.add(exit);

    // JMenu viewMenu = new JMenu("View");//@@
    // viewMenu.add(windowsLookAndFeel);//@@
    // viewMenu.add(metalLookAndFeel); //@@
    // viewMenu.add(motifLookAndFeel); //@@

    // JMenu debugMenu = new JMenu("Debug");//@@
    // debugMenu.add(debugOutput);//@@
    // debugMenu.add(errorOutput);//@@

    // JMenu communityMenu = new JMenu("Community");//@@
    // communityMenu.add(catalogOfApatars);//@@
    // communityMenu.add(demos);//@@
    // communityMenu.add(forums);//@@
    // communityMenu.add(wiki);//@@

    /*
     * @@ JMenu helpMenu = new JMenu("Help"); helpMenu.add(about);
     * helpMenu.addSeparator(); helpMenu.add(featureRequest);
     * helpMenu.add(submitBug); helpMenu.add(tutorials);
     */
    menubar.add(fileMenu);
    // menubar.add(viewMenu);//@@
    // menubar.add(debugMenu);//@@
    // menubar.add(communityMenu);//@@
    // menubar.add(helpMenu);//@@
}

From source file:org.pgptool.gui.ui.mainframe.MainFrameView.java

private void initMenuBar() {
    menuBar = new JMenuBar();

    JMenu menuFile = new JMenu(Messages.get("term.appTitle"));
    menuFile.add(miChangeTempFolderForDecrypted = new JMenuItem());
    menuFile.addSeparator();
    menuFile.add(miBmc = new JMenuItem());
    menuFile.add(miWriteFeedback = new JMenuItem());
    menuFile.add(miFaq = new JMenuItem());
    menuFile.add(miHelp = new JMenuItem());
    menuFile.addSeparator();/*from www .j a  v a2  s .  c o m*/
    menuFile.add(miAbout = new JMenuItem());
    menuFile.add(miCheckForUpdates = new JMenuItem());
    menuFile.add(miAutoCheckForUpdates = new JCheckBoxMenuItem());
    menuFile.addSeparator();
    menuFile.add(miConfigExit = new JMenuItem());

    JMenu menuKeyring = new JMenu(Messages.get("term.keyring"));
    menuKeyring.add(miShowKeyList = new JMenuItem());
    menuKeyring.addSeparator();
    menuKeyring.add(miPgpImportKey = new JMenuItem());
    menuKeyring.add(miPgpCreateKey = new JMenuItem());

    JMenu menuActions = new JMenu(Messages.get("term.actions"));
    menuActions.add(miEncrypt = new JMenuItem());
    menuActions.add(miEncryptText = new JMenuItem());
    menuActions.addSeparator();
    menuActions.add(miDecrypt = new JMenuItem());
    menuActions.add(miDecryptText = new JMenuItem());
    menuActions.addSeparator();
    menuActions.add(miEncryptBackAll = new JMenuItem());

    menuBar.add(menuFile);
    menuBar.add(menuKeyring);
    menuBar.add(menuActions);
}

From source file:de.freese.base.swing.mac_os_x.MyApp.java

/**
 *
 *//*from w  w  w.ja  va 2 s.c o m*/
public void addMenus() {
    JMenu fileMenu = new JMenu("File");
    JMenuBar mainMenuBar = new JMenuBar();
    mainMenuBar.add(fileMenu = new JMenu("File"));
    fileMenu.add(this.openMI = new JMenuItem("Open..."));
    this.openMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, MENU_MASK));
    this.openMI.addActionListener(this);

    // Quit/prefs menu items are provided on Mac OS X; only add your own on other platforms
    if (!IS_OS_MAC_OSX) {
        fileMenu.addSeparator();
        fileMenu.add(this.optionsMI = new JMenuItem("Options"));
        this.optionsMI.addActionListener(this);

        fileMenu.addSeparator();
        fileMenu.add(this.quitMI = new JMenuItem("Quit"));
        this.quitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, MENU_MASK));
        this.quitMI.addActionListener(this);
    }

    mainMenuBar.add(this.helpMenu = new JMenu("Help"));
    this.helpMenu.add(this.docsMI = new JMenuItem("Online Documentation"));
    this.helpMenu.addSeparator();
    this.helpMenu.add(this.supportMI = new JMenuItem("Technical Support"));

    // About menu item is provided on Mac OS X; only add your own on other platforms
    if (!IS_OS_MAC_OSX) {
        this.helpMenu.addSeparator();
        this.helpMenu.add(this.aboutMI = new JMenuItem("About OSXAdapter"));
        this.aboutMI.addActionListener(this);
    }

    setJMenuBar(mainMenuBar);
}

From source file:daylightchart.gui.DaylightChartGui.java

private void createOptionsMenu(final JMenuBar menuBar, final JToolBar toolBar) {

    final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.Options")); //$NON-NLS-1$
    menu.setMnemonic('O');

    final GuiAction options = new OptionsAction(this);
    menu.add(options);//from   ww w . ja va 2  s. com

    final GuiAction chartOptions = new ChartOptionsAction(this);
    menu.add(chartOptions);

    final GuiAction resetAll = new ResetAllAction(this);
    menu.add(resetAll);

    menu.addSeparator();

    final JCheckBoxMenuItem slimUiMenuItem = new JCheckBoxMenuItem(
            Messages.getString("DaylightChartGui.Menu.Options.SlimUi")); //$NON-NLS-1$
    slimUiMenuItem.setState(isSlimUi());
    slimUiMenuItem.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(final ItemEvent e) {
            final boolean slimUi = e.getStateChange() == ItemEvent.SELECTED;
            final Options options = UserPreferences.optionsFile().getData();
            options.setSlimUi(slimUi);
            UserPreferences.optionsFile().save(options);
            ResetAllAction.restart(DaylightChartGui.this, slimUi);
        }
    });
    menu.add(slimUiMenuItem);

    menuBar.add(menu);

    toolBar.add(options);
    toolBar.add(chartOptions);
    toolBar.addSeparator();
}

From source file:com.intuit.tank.proxy.ProxyApp.java

@SuppressWarnings("serial")
public JMenuBar createMenu() {
    JMenuBar ret = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenu sessionMenu = new JMenu("Session");
    ret.add(fileMenu);// w  w  w.ja va2  s .co  m
    ret.add(sessionMenu);

    fileMenu.add(getMenuItem(openAction));
    fileMenu.add(getMenuItem(saveAction));
    fileMenu.addSeparator();
    fileMenu.add(getMenuItem(filterAction));
    fileMenu.add(getMenuItem(settingsAction));
    fileMenu.addSeparator();
    AbstractAction quitAction = new AbstractAction("Quit") {
        public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
        }
    };
    quitAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, keyMask));
    quitAction.putValue(javax.swing.Action.MNEMONIC_KEY, KeyEvent.VK_Q);

    fileMenu.add(new JMenuItem(quitAction));
    sessionMenu.add(getMenuItem(startAction));
    sessionMenu.add(getMenuItem(stopAction));
    sessionMenu.add(getMenuItem(pauseAction));
    sessionMenu.addSeparator();
    sessionMenu.add(getMenuItem(showHostsAction));

    return ret;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

private JMenu createEditMenu() {

    JMenu edit_menu = new JMenu("Edit");
    edit_menu.setMnemonic(KeyEvent.VK_E);
    edit_menu.add(theActionManager.get("undo"));
    edit_menu.add(theActionManager.get("redo"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("cut"));
    edit_menu.add(theActionManager.get("copy"));
    edit_menu.add(theActionManager.get("delete"));
    edit_menu.add(theActionManager.get("screenshot"));
    edit_menu.addSeparator();// www  .  ja v a 2 s .com
    edit_menu.add(theActionManager.get("selectall"));
    edit_menu.add(theActionManager.get("selectnone"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("enlarge"));
    edit_menu.add(theActionManager.get("resetsize"));
    edit_menu.add(theActionManager.get("shrink"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("group"));
    edit_menu.add(theActionManager.get("ungroup"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("placestructures"));

    return edit_menu;
}

From source file:org.simbrain.plot.projection.ProjectionGui.java

/**
 * Creates the menu bar./*from  w w  w  .  j av  a 2  s. co m*/
 */
private void createAttachMenuBar() {

    final JMenuBar bar = new JMenuBar();
    final JMenu fileMenu = new JMenu("File");

    for (Action action : actionManager.getOpenSavePlotActions()) {
        fileMenu.add(action);
    }
    fileMenu.addSeparator();
    final JMenu exportImport = new JMenu("Export/Import...");
    fileMenu.add(exportImport);
    exportImport.add(ProjectionPlotActions.getImportData(getWorkspaceComponent().getProjectionModel()));
    exportImport.addSeparator();
    exportImport.add(ProjectionPlotActions.getExportDataHi(getWorkspaceComponent().getProjectionModel()));
    exportImport.add(ProjectionPlotActions.getExportDataLow(getWorkspaceComponent().getProjectionModel()));
    fileMenu.addSeparator();
    fileMenu.add(new CloseAction(this.getWorkspaceComponent()));

    final JMenu editMenu = new JMenu("Edit");
    final JMenuItem preferencesGeneral = new JMenuItem("General Preferences...");
    preferencesGeneral.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            ProjectionPreferencesDialog dialog = new ProjectionPreferencesDialog(
                    getWorkspaceComponent().getProjectionModel().getProjector());
            dialog.pack();
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);
        }

    });
    editMenu.add(preferencesGeneral);

    final JMenuItem colorPrefs = new JMenuItem("Datapoint Coloring...");
    colorPrefs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DataPointColoringDialog dialog = new DataPointColoringDialog(
                    getWorkspaceComponent().getProjectionModel());
            dialog.pack();
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);

        }

    });
    editMenu.add(colorPrefs);

    final JMenuItem dims = new JMenuItem("Set dimensions...");
    dims.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            String dimensions = JOptionPane.showInputDialog("Dimensions:");
            if (dimensions != null) {
                getWorkspaceComponent().getProjectionModel().getProjector().init(Integer.parseInt(dimensions));
            }

        }

    });
    // editMenu.add(dims);

    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpItem = new JMenuItem(helpAction);
    helpMenu.add(helpItem);

    bar.add(fileMenu);
    bar.add(editMenu);
    bar.add(helpMenu);

    getParentFrame().setJMenuBar(bar);
}

From source file:TextComponentDemo.java

protected JMenu createStyleMenu() {
    JMenu menu = new JMenu("Style");

    Action action = new StyledEditorKit.BoldAction();
    action.putValue(Action.NAME, "Bold");
    menu.add(action);/*from w  ww .  j  a va  2 s. c  o m*/

    action = new StyledEditorKit.ItalicAction();
    action.putValue(Action.NAME, "Italic");
    menu.add(action);

    action = new StyledEditorKit.UnderlineAction();
    action.putValue(Action.NAME, "Underline");
    menu.add(action);

    menu.addSeparator();

    menu.add(new StyledEditorKit.FontSizeAction("12", 12));
    menu.add(new StyledEditorKit.FontSizeAction("14", 14));
    menu.add(new StyledEditorKit.FontSizeAction("18", 18));

    menu.addSeparator();

    menu.add(new StyledEditorKit.FontFamilyAction("Serif", "Serif"));
    menu.add(new StyledEditorKit.FontFamilyAction("SansSerif", "SansSerif"));

    menu.addSeparator();

    menu.add(new StyledEditorKit.ForegroundAction("Red", Color.red));
    menu.add(new StyledEditorKit.ForegroundAction("Green", Color.green));
    menu.add(new StyledEditorKit.ForegroundAction("Blue", Color.blue));
    menu.add(new StyledEditorKit.ForegroundAction("Black", Color.black));

    return menu;
}

From source file:StocksTable5.java

protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();

    JMenu mFile = new JMenu("File");
    mFile.setMnemonic('f');

    JMenuItem mData = new JMenuItem("Retrieve Data...");
    mData.setMnemonic('r');
    ActionListener lstData = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            retrieveData();/*from   ww  w  . j  a va 2  s .  c om*/
        }
    };
    mData.addActionListener(lstData);
    mFile.add(mData);
    mFile.addSeparator();

    JMenuItem mExit = new JMenuItem("Exit");
    mExit.setMnemonic('x');
    ActionListener lstExit = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    };
    mExit.addActionListener(lstExit);
    mFile.add(mExit);
    menuBar.add(mFile);

    return menuBar;
}

From source file:com.github.rholder.gradle.ui.DependencyViewerStandalone.java

private void initMenu() {
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);//ww  w  .j  a v a 2 s.com

    JMenuItem open = new JMenuItem("Open Project Folder", KeyEvent.VK_O);
    open.setMnemonic(KeyEvent.VK_O);
    open.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            promptForGradleBaseDir();
            refresh();
        }
    });
    fileMenu.add(open);

    JMenuItem refresh = new JMenuItem("Refresh");
    refresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            refresh();
        }
    });
    fileMenu.add(refresh);

    fileMenu.addSeparator();
    JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
    exit.setMnemonic(KeyEvent.VK_X);
    exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.add(exit);

    setJMenuBar(menuBar);
}