Example usage for java.awt Event CTRL_MASK

List of usage examples for java.awt Event CTRL_MASK

Introduction

In this page you can find the example usage for java.awt Event CTRL_MASK.

Prototype

int CTRL_MASK

To view the source code for java.awt Event CTRL_MASK.

Click Source Link

Document

This flag indicates that the Control key was down when the event occurred.

Usage

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes saveMenuItem//from ww  w  .ja  va  2 s .  com
 *
 * @return javax.swing.JMenuItem
 */
private JMenuItem getSaveMenuItem() {
    if (saveMenuItem == null) {
        saveMenuItem = new JMenuItem(saveAction);
        saveMenuItem.setEnabled(false);
        saveMenuItem.setMnemonic(KeyEvent.VK_S);
        saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK, true));
    }
    return saveMenuItem;
}

From source file:org.apache.cassandra.contrib.circuit.CircuitFrame.java

public CircuitFrame(String hostname, int port) {
    super(appTitle);
    setSize(defaultSize);/* www  .  j a v  a 2 s.co m*/
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // The menu bar w/ items.
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    quitMI = new JMenuItem("Quit");
    quitMI.setMnemonic(KeyEvent.VK_Q);
    quitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK));
    quitMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.add(quitMI);

    JMenu toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    menuBar.add(toolsMenu);

    verifyMI = new JMenuItem("Verify Ring");
    verifyMI.addActionListener(this);
    toolsMenu.add(verifyMI);

    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    aboutMI = new JMenuItem("About");
    aboutMI.setMnemonic(KeyEvent.VK_A);
    aboutMI.addActionListener(this);
    helpMenu.add(aboutMI);

    // FIXME: a progress dialog should be up while instantiating RingPanel
    ringModel = new RingModel(hostname, port);
    ringPanel = new RingPanel(ringModel);

    statusOutput = new JTextArea();
    statusOutput.setEditable(false);
    Component logPanel = new JScrollPane(statusOutput);

    JSplitPane contentPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, ringPanel, logPanel);
    setContentPane(contentPane);

    // Order matters here...
    ringPanel.setPreferredSize(getSize());
    setVisible(true);
    contentPane.setDividerLocation(0.8);
}

From source file:org.geopublishing.atlasStyler.swing.AtlasStylerGUI.java

/**
 * Creates a nre {@link JMenuBar} instance
 *///  w  ww .  ja  va 2s .  co  m
private JMenuBar createMenuBar() {
    JMenuBar jMenuBar = new JMenuBar();

    JMenu fileMenu = new JMenu(AsSwingUtil.R("MenuBar.FileMenu"));

    jMenuBar.add(fileMenu);

    { // Import WIzard
        JMenuItem mi = new JMenuItem(new AbstractAction(AsSwingUtil.R("MenuBar.FileMenu.ImportWizard")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                ImportWizard.showWizard(AtlasStylerGUI.this, AtlasStylerGUI.this);
            }
        });
        mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, true));
        fileMenu.add(mi);
    }

    fileMenu.add(SwingUtil.createChangeLog4JLevelJMenu());

    /**
     * MenuItem to create a new language
     */
    JMenuItem manageLanguageJMenuitem = new JMenuItem(
            new AbstractAction(ASUtil.R("TranslateSoftwareDialog.Title"), Icons.ICON_FLAGS_SMALL) {

                @Override
                public void actionPerformed(ActionEvent e) {
                    String resPath = IOUtil
                            .escapePath(System.getProperty("user.home") + File.separator + ".Geopublishing");
                    ResourceProviderManagerFrame manLanguagesFrame = new ResourceProviderManagerFrame(
                            AtlasStylerGUI.this, true, AsSwingUtil.R("TranslateSoftwareDialog.Explanation.Html",
                                    resPath, SystemUtils.IS_OS_WINDOWS ? "bat" : "sh"));
                    manLanguagesFrame.setRootPath(new File(resPath));
                    manLanguagesFrame.setTitle(ASUtil.R("TranslateSoftwareDialog.Title"));
                    manLanguagesFrame.setPreferredSize(new Dimension(780, 450));
                    manLanguagesFrame.setVisible(true);
                }
            });
    fileMenu.add(manageLanguageJMenuitem);

    AbstractAction optionsButton = new AbstractAction(AtlasStylerVector.R("Options.ButtonLabel")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            new ASOptionsDialog(AtlasStylerGUI.this, AtlasStylerGUI.this);
        }
    };

    fileMenu.add(optionsButton);

    { // Exit
        JMenuItem mi = new JMenuItem(new AbstractAction(
                GpCoreUtil.R("AtlasViewer.FileMenu.ExitMenuItem.exit_application"), Icons.ICON_EXIT_SMALL) {

            @Override
            public void actionPerformed(ActionEvent e) {
                exitAS(0);
            }
        });
        fileMenu.add(mi);
    }

    return jMenuBar;
}

From source file:org.geopublishing.atlasStyler.swing.AtlasStylerGUI.java

/**
 * This method initializes jToolBar/*w w w.j  av a2 s.co  m*/
 * 
 * @return javax.swing.JToolBar
 */
private JToolBar getJToolBar() {
    JToolBar jToolBar = new JToolBar();

    jToolBar.setFloatable(false);

    AbstractAction importWiazrdAction = new AbstractAction(
            AtlasStylerVector.R("MenuBar.FileMenu.ImportWizard")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ImportWizard.showWizard(AtlasStylerGUI.this, AtlasStylerGUI.this);
        }
    };
    importWiazrdAction.putValue(Action.LONG_DESCRIPTION,
            KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, true));
    jToolBar.add(importWiazrdAction);

    jToolBar.add(getJTButtonShowXML());
    jToolBar.add(getJTButtonExportAsSLD());

    return jToolBar;
}

From source file:org.gtdfree.GTDFree.java

/**
 * This method initializes jMenuItem   /*from www . j a  v a  2 s. c  o m*/
 *    
 * @return javax.swing.JMenuItem   
 */
private JMenuItem getSaveMenuItem() {
    if (saveMenuItem == null) {
        saveMenuItem = new JMenuItem();
        saveMenuItem.setText(Messages.getString("GTDFree.File.Save")); //$NON-NLS-1$
        saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK, true));
        saveMenuItem.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_save));
        saveMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                try {
                    getEngine().save();
                    Logger.getLogger(this.getClass()).debug("Save successful."); //$NON-NLS-1$
                } catch (Exception ex) {
                    Logger.getLogger(this.getClass()).error("Save failed.", ex); //$NON-NLS-1$
                    JOptionPane.showMessageDialog(getJFrame(), "Save failed: '" + ex.getMessage() + "'.", //$NON-NLS-1$//$NON-NLS-2$
                            "Save Failed", JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
                }
            }

        });
    }
    return saveMenuItem;
}

From source file:org.jab.docsearch.DocSearch.java

/**
 * Creates menu bar//www  .  j  av  a 2 s.  c  om
 *
 * @param menuBar  Menu bar
 */
private JMenuBar createMenuBar() {

    // menu bar
    JMenuBar menuBar = new JMenuBar();

    // ----- menu file

    // menu item print
    JMenuItem menuItemPrint = new JMenuItem(I18n.getString("menuitem.print"));
    menuItemPrint.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK));
    menuItemPrint.setActionCommand("ac_print");
    menuItemPrint.addActionListener(this);

    // scale X
    JRadioButtonMenuItem scaleXRadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_width"));
    scaleXRadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK));
    scaleXRadioBut.addActionListener(new ScaleXListener());
    // scale Y
    JRadioButtonMenuItem scaleYRadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_length"));
    scaleYRadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK));
    scaleYRadioBut.addActionListener(new ScaleYListener());
    // scale fit
    JRadioButtonMenuItem scaleFitRadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_to_fit"));
    scaleFitRadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK));
    scaleFitRadioBut.addActionListener(new ScaleFitListener());
    // scale half
    JRadioButtonMenuItem scaleHalfRadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_half"));
    scaleHalfRadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, Event.CTRL_MASK));
    scaleHalfRadioBut.addActionListener(new ScaleHalfListener());
    // scale double
    JRadioButtonMenuItem scale2RadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_2x"));
    scale2RadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK));
    scale2RadioBut.addActionListener(new Scale2Listener());
    // scale off
    JRadioButtonMenuItem scaleOffRadioBut = new JRadioButtonMenuItem(I18n.getString("print_scale_off"), true);
    scaleOffRadioBut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK));

    ButtonGroup scaleSetGroup = new ButtonGroup();
    scaleSetGroup.add(scale2RadioBut);
    scaleSetGroup.add(scaleFitRadioBut);
    scaleSetGroup.add(scaleHalfRadioBut);
    scaleSetGroup.add(scaleOffRadioBut);
    scaleSetGroup.add(scaleXRadioBut);
    scaleSetGroup.add(scaleYRadioBut);

    // build complete menu print preferences
    JMenu menuPrintPref = new JMenu(I18n.getString("menuitem.print_preferences"), true);
    menuPrintPref.add(scaleXRadioBut);
    menuPrintPref.add(scaleYRadioBut);
    menuPrintPref.add(scaleFitRadioBut);
    menuPrintPref.add(scaleHalfRadioBut);
    menuPrintPref.add(scale2RadioBut);
    menuPrintPref.addSeparator();
    menuPrintPref.add(scaleOffRadioBut);

    // menu item exit
    JMenuItem menuItemExit = new JMenuItem(I18n.getString("menuitem.exit"));
    menuItemExit.setActionCommand("ac_exit");
    menuItemExit.addActionListener(this);

    // build complete menu file
    JMenu menuFile = new JMenu(I18n.getString("menu.file"));
    menuFile.add(menuItemPrint);
    menuFile.add(menuPrintPref);
    menuFile.addSeparator();
    menuFile.add(menuItemExit);

    // add menu to menu bar
    menuBar.add(menuFile);

    // ----- menu index

    // menu item new
    JMenuItem menuItemNewIndex = new JMenuItem(I18n.getString("menuitem.new_index"));
    menuItemNewIndex.setActionCommand("ac_newindex");
    menuItemNewIndex.addActionListener(this);
    // menu item new spider
    JMenuItem menuItemNewSpiderIndex = new JMenuItem(I18n.getString("menuitem.new_spider_index"));
    menuItemNewSpiderIndex.setActionCommand("ac_newspiderindex");
    menuItemNewSpiderIndex.addActionListener(this);
    // menu item manage
    JMenuItem menuItemManageIndex = new JMenuItem(I18n.getString("menuitem.manage_indexes"));
    menuItemManageIndex.setActionCommand("ac_manageindex");
    menuItemManageIndex.addActionListener(this);
    // menu item rebuild
    JMenuItem menuItemRebuildIndex = new JMenuItem(I18n.getString("menuitem.rebuild_all_indexes"));
    menuItemRebuildIndex.setActionCommand("ac_rebuildindexes");
    menuItemRebuildIndex.addActionListener(this);
    // menu item import
    JMenuItem menuItemImportIndex = new JMenuItem(I18n.getString("menuitem.import_index"));
    menuItemImportIndex.setActionCommand("ac_importindex");
    menuItemImportIndex.addActionListener(this);

    // build complete menu index
    JMenu indexMenu = new JMenu(I18n.getString("menu.index"));
    indexMenu.add(menuItemNewIndex);
    indexMenu.add(menuItemNewSpiderIndex);
    indexMenu.add(menuItemManageIndex);
    indexMenu.add(menuItemRebuildIndex);
    indexMenu.addSeparator();
    indexMenu.add(menuItemImportIndex);

    // add menu to menu bar
    menuBar.add(indexMenu);

    // ----- menu bookmark

    // menu item add
    JMenuItem menuItemAddBookmark = new JMenuItem(I18n.getString("menuitem.add_bookmark"));
    menuItemAddBookmark.setActionCommand("ac_addbookmark");
    menuItemAddBookmark.addActionListener(this);
    // menu item delete all
    JMenuItem menuItemDeleteAll = new JMenuItem(I18n.getString("menuitem.delete_all_bookmarks"));
    menuItemDeleteAll.setActionCommand("ac_deleteallbookmarks");
    menuItemDeleteAll.addActionListener(this);

    // build complete menu index
    bookMarkMenu = new JMenu(I18n.getString("menu.bookmarks"));
    bookMarkMenu.add(menuItemAddBookmark);
    bookMarkMenu.add(menuItemDeleteAll);
    bookMarkMenu.addSeparator();

    // add menu to menu bar
    menuBar.add(bookMarkMenu);

    // ----- menu report

    // menu item metadata report
    JMenuItem menuItemMetadataReport = new JMenuItem(I18n.getString("menuitem.metadata_report"));
    menuItemMetadataReport.setActionCommand("ac_metadata_report");
    menuItemMetadataReport.addActionListener(this);
    // menu item servlet report
    JMenuItem menuItemServletReport = new JMenuItem(I18n.getString("menuitem.servlet_log_report"));
    menuItemServletReport.setActionCommand("ac_servlet_log_report");
    menuItemServletReport.addActionListener(this);

    // build complete menu report
    JMenu reportMenu = new JMenu(I18n.getString("menu.reports"));
    reportMenu.add(menuItemMetadataReport);
    reportMenu.add(menuItemServletReport);

    // add menu to menu bar
    menuBar.add(reportMenu);

    // ----- menu tools

    // menu item makr cd
    JMenuItem menuItemMakeCD = new JMenuItem(I18n.getString("menuitem.make_cd"));
    menuItemMakeCD.setActionCommand("ac_makecd");
    menuItemMakeCD.addActionListener(this);
    // menu item setting
    JMenuItem menuItemSetting = new JMenuItem(I18n.getString("menuitem.settings"));
    menuItemSetting.setActionCommand("ac_settings");
    menuItemSetting.addActionListener(this);

    // build complete menu report
    JMenu menuTool = new JMenu(I18n.getString("menu.tools"));
    menuTool.add(menuItemMakeCD);
    menuTool.addSeparator();
    menuTool.add(menuItemSetting);

    // add menu to menu bar
    menuBar.add(menuTool);

    // ----- menu help

    // menu item search tip
    JMenuItem menuItemSearchTip = new JMenuItem(I18n.getString("menuitem.search_tips"));
    menuItemSearchTip.setActionCommand("ac_search_tips");
    menuItemSearchTip.addActionListener(this);
    // menu item about
    JMenuItem menuItemAbout = new JMenuItem(I18n.getString("menuitem.about"));
    menuItemAbout.setActionCommand("ac_about");
    menuItemAbout.addActionListener(this);

    // build complete menu help
    JMenu menuHelp = new JMenu(I18n.getString("menu.help"));
    menuHelp.add(menuItemSearchTip);
    menuHelp.add(menuItemAbout);

    // add menu to menu bar
    menuBar.add(menuHelp);

    // finished
    return menuBar;
}

From source file:org.vpac.grix.view.swing.Grix.java

/**
 * This method initializes jMenuItem/*  ww w.  j  a  v a 2 s. co m*/
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getCopyMenuItem() {
    if (copyMenuItem == null) {
        copyMenuItem = new JMenuItem();
        copyMenuItem.setText("Copy");
        copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK, true));
    }
    return copyMenuItem;
}

From source file:org.vpac.grix.view.swing.Grix.java

/**
 * This method initializes jMenuItem//from   w  w  w . j ava2s .  co  m
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getCutMenuItem() {
    if (cutMenuItem == null) {
        cutMenuItem = new JMenuItem();
        cutMenuItem.setText("Cut");
        cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK, true));
    }
    return cutMenuItem;
}

From source file:org.vpac.grix.view.swing.Grix.java

/**
 * This method initializes jMenuItem/*from   w  ww. j a  v  a  2s . c  o  m*/
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getPasteMenuItem() {
    if (pasteMenuItem == null) {
        pasteMenuItem = new JMenuItem();
        pasteMenuItem.setText("Paste");
        pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK, true));
    }
    return pasteMenuItem;
}

From source file:org.vpac.grix.view.swing.Grix.java

/**
 * This method initializes jMenuItem//from w  ww. j a  v  a2s  .  c  o  m
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getSaveMenuItem() {
    if (saveMenuItem == null) {
        saveMenuItem = new JMenuItem();
        saveMenuItem.setText("Save");
        saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK, true));
    }
    return saveMenuItem;
}