Example usage for javax.swing JMenuItem JMenuItem

List of usage examples for javax.swing JMenuItem JMenuItem

Introduction

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

Prototype

public JMenuItem(Action a) 

Source Link

Document

Creates a menu item whose properties are taken from the specified Action.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTldFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*from   w  ww  .  j a v a2 s. co  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddTld = new ActionAddTld();
        menuItem = new JMenuItem(actionAddTld);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedTld();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedTld();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedTld();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:dmh.kuebiko.view.NoteStackFrame.java

/**
 * Initialize the contents of the frame. The contents of this method was
 * generated by Window Builder Pro./*from w  w  w.j  av a 2  s  .c o m*/
 */
private void initialize() {
    setTitle(buildTitle());
    setBounds(100, 100, 450, 300);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 0, 0, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE };
    getContentPane().setLayout(gridBagLayout);

    horizontalStrut = Box.createHorizontalStrut(20);
    horizontalStrut.setMinimumSize(new Dimension(3, 0));
    horizontalStrut.setPreferredSize(new Dimension(3, 0));
    horizontalStrut.setSize(new Dimension(3, 0));
    GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
    gbc_horizontalStrut.insets = new Insets(0, 0, 0, 0);
    gbc_horizontalStrut.gridx = 0;
    gbc_horizontalStrut.gridy = 0;
    getContentPane().add(horizontalStrut, gbc_horizontalStrut);

    GridBagConstraints gbc_stateImageLabel = new GridBagConstraints();
    gbc_stateImageLabel.insets = new Insets(0, 0, 0, 0);
    gbc_stateImageLabel.anchor = GridBagConstraints.EAST;
    gbc_stateImageLabel.gridx = 1;
    gbc_stateImageLabel.gridy = 0;
    stateImageLabel.setBorder(null);
    stateImageLabel.setHorizontalAlignment(SwingConstants.CENTER);
    getContentPane().add(stateImageLabel, gbc_stateImageLabel);

    searchText = new JTextField();
    GridBagConstraints gbc_searchText = new GridBagConstraints();
    gbc_searchText.insets = new Insets(0, 0, 0, 0);
    gbc_searchText.fill = GridBagConstraints.HORIZONTAL;
    gbc_searchText.gridx = 2;
    gbc_searchText.gridy = 0;
    getContentPane().add(searchText, gbc_searchText);
    searchText.setColumns(10);
    if (SystemUtils.IS_OS_MAC_OSX) {
        // Make the text field look like the standard Mac OS X search
        // box control.
        searchText.putClientProperty("JTextField.variant", "search");
    }

    splitPane = new JSplitPane();
    splitPane.setBorder(null);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    GridBagConstraints gbc_splitPane = new GridBagConstraints();
    gbc_splitPane.gridwidth = 3;
    gbc_splitPane.gridheight = 4;
    gbc_splitPane.insets = new Insets(0, 0, 0, 0);
    gbc_splitPane.fill = GridBagConstraints.BOTH;
    gbc_splitPane.gridx = 0;
    gbc_splitPane.gridy = 1;
    getContentPane().add(splitPane, gbc_splitPane);

    notePanel = new NotePanel();
    notePanel.getHuxleyUiManager().setOnTextChangeCallback(new Callback<Boolean>() {
        @Override
        public void callback(Boolean input) {
            toggleUnsavedChangeIndicator(input);
        }
    });
    splitPane.setRightComponent(notePanel);

    noteTableScroll = new JScrollPane();
    noteTableScroll.setMinimumSize(new Dimension(23, 100));
    splitPane.setLeftComponent(noteTableScroll);
    noteTable = newNoteTable();
    noteTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    noteTableScroll.setViewportView(noteTable);

    ActionObserverUtil.registerEnMass(actionMngr, observable,
            notePanel.getHuxleyUiManager().getTextAction(TextAction.INSERT_DATE));

    insertDateMenuItem = new JMenuItem(actionMngr.getAction(InsertDynamicTextAction.class));
    insertDateMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,
            InputEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    textMenu.add(insertDateMenuItem);
}

From source file:mendeley2kindle.MainUIFrame.java

public MainUIFrame(Properties config, Mendeley2Kindle core) {
    super("Mendeley2Kindle");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    this.core = core;
    core.addStateListener(new UISyncStateListener());

    components = new ArrayList<JComponent>();

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem openMenuItem = new JMenuItem("Open Mendeley database");
    openMenuItem.addActionListener(new OpenMendeleyListener());
    JMenuItem selectKindleMenuItem = new JMenuItem("Select Kindle device path");
    selectKindleMenuItem.addActionListener(new SelectKindleListener());
    JMenuItem exitMenuItem = new JMenuItem("Quit");
    exitMenuItem.addActionListener(new QuitListener());
    fileMenu.add(openMenuItem);//  w  w  w .ja  v  a2  s.  c  o  m
    fileMenu.add(selectKindleMenuItem);
    fileMenu.add(exitMenuItem);
    menuBar.add(fileMenu);

    JMenu helpMenu = new JMenu("Help");
    JMenuItem aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "Mendeley2Kindle 0.3.2\n"
                    + " (c) Copyright Yukinari Toyota, 2013. All rights reserved.\n"
                    + " Contact: Yukinari Toyota <xxseyxx@gmail.com>\n"
                    + " Site: http://sites.google.com/site/xxseyxx/\n" + "Some Icons by Yusuke Kamiyamane\n"
                    + " Site: http://p.yusukekamiyamane.com/\n"
                    + "sqlite-jdbc-3.7.2.jar is provided by xerial.org\n"
                    + " under Apache License version 2.0 (http://www.apache.org/licenses/ )\n"
                    + " Site: https://bitbucket.org/xerial/sqlite-jdbc\n";
            JOptionPane.showMessageDialog(MainUIFrame.this, text);
        }
    });
    helpMenu.add(aboutMenuItem);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    getContentPane().add(new JLabel("Select Mendeley collections"));

    collectionsJList = new JList();
    DragSelectionListener mil = new DragSelectionListener();
    collectionsJList.addMouseMotionListener(mil);
    collectionsJList.addMouseListener(mil);
    collectionsJList.setCellRenderer(new MyCellRenderer());
    // collectionsJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    JScrollPane scroll = new JScrollPane();
    scroll.setPreferredSize(new Dimension(200, 300));
    scroll.getViewport().setView(collectionsJList);
    getContentPane().add(scroll);

    mainButton = new JButton("Open Mendeley database");
    mainButton.addActionListener(new OpenMendeleyListener());
    getContentPane().add(mainButton);

    components.add(collectionsJList);

    for (JComponent c : components)
        c.setEnabled(false);

    pack();
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingClusterFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*  w  w  w. j a  va2 s  .co  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddCluster = new ActionAddCluster();
        menuItem = new JMenuItem(actionAddCluster);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedCluster();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedCluster();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedCluster();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:edu.harvard.mcz.imagecapture.encoder.UnitTrayLabelBrowser.java

private JMenuItem getJMenuItemUndo() {
    if (jMenuItemUndo == null) {
        undoAction = new UndoAction();
        jMenuItemUndo = new JMenuItem(undoAction);
        jMenuItemUndo.setText("Undo");
        jMenuItemUndo.setMnemonic(KeyEvent.VK_U);
        jMenuItemUndo.setEnabled(false);
    }/*from w  w  w . j  a v a 2 s.c o m*/
    return jMenuItemUndo;
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingSecUserFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;//w  w w. j a v a2  s . c o  m
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddSecUser = new ActionAddSecUser();
        menuItem = new JMenuItem(actionAddSecUser);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedSecUser();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedSecUser();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedSecUser();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchSwing.CFFreeSwitchSwingPbxIvrMenuFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*from w w  w  .j a v  a2  s.com*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddPbxIvrMenu = new ActionAddPbxIvrMenu();
        menuItem = new JMenuItem(actionAddPbxIvrMenu);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedPbxIvrMenu();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedPbxIvrMenu();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedPbxIvrMenu();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingMimeTypeFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*from  w w  w .j  a  v  a 2  s . c  o  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddMimeType = new ActionAddMimeType();
        menuItem = new JMenuItem(actionAddMimeType);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedMimeType();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedMimeType();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedMimeType();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxSwing.CFEnSyntaxSwingEnHeadFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*  w w w . ja v  a 2  s  . co  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddEnHead = new ActionAddEnHead();
        menuItem = new JMenuItem(actionAddEnHead);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedEnHead();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedEnHead();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedEnHead();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTenantFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;//from   w  w w.  j a v a 2  s.com
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddTenant = new ActionAddTenant();
        menuItem = new JMenuItem(actionAddTenant);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedTenant();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedTenant();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedTenant();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}