Example usage for java.awt.event KeyEvent VK_S

List of usage examples for java.awt.event KeyEvent VK_S

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_S.

Prototype

int VK_S

To view the source code for java.awt.event KeyEvent VK_S.

Click Source Link

Document

Constant for the "S" key.

Usage

From source file:edu.harvard.i2b2.query.ui.QueryConceptTreePanel.java

private void createPopupMenu() {
    JMenuItem menuItem;/*w  w w . j av a2  s .c  o  m*/

    //Create the popup menu.
    JPopupMenu popup = new JPopupMenu();
    /*menuItem = new JMenuItem("Constrain Item ...");
      menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, 
      java.awt.event.InputEvent.CTRL_MASK));
      menuItem.addActionListener(this);
      popup.add(menuItem);*/

    menuItem = new JMenuItem("Delete Item");
    menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X,
            java.awt.event.InputEvent.CTRL_MASK));
    menuItem.addActionListener(this);
    popup.add(menuItem);

    /*popup.add(new javax.swing.JSeparator());
            
      menuItem = new JMenuItem("Exclude All Items");
      menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, 
      java.awt.event.InputEvent.CTRL_MASK));
      menuItem.addActionListener(this);
      popup.add(menuItem);*/

    popup.add(new javax.swing.JSeparator());

    menuItem = new JMenuItem("Set Value ...");
    menuItem.setEnabled(false);
    menuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    menuItem.addActionListener(this);
    popup.add(menuItem);

    //Add listener to the tree
    MouseListener popupListener = new ConceptTreePopupListener(popup);
    jTree1.addMouseListener(popupListener);
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Configures the assertions file menu. Called at startup
 * and whenever an assertions file is opened or saved since
 * the list of recent assertions files is presented on the
 * file menu./*from  w  w  w.j  av  a 2s .  c o m*/
 */
private void setupAssertionsFileMenu() {
    fileAssertionsMenu.removeAll();

    fileOpenTriplesFile = new JMenuItem("Open Assertions File");
    fileOpenTriplesFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_MASK));
    fileOpenTriplesFile.setMnemonic('A');
    fileOpenTriplesFile.setToolTipText("Open an asserted triples file");
    fileOpenTriplesFile.addActionListener(new FileAssertedTriplesOpenListener());
    fileAssertionsMenu.add(fileOpenTriplesFile);

    fileOpenTriplesUrl = new JMenuItem("Open Assertions Url");
    fileOpenTriplesUrl.setMnemonic('U');
    fileOpenTriplesUrl.setToolTipText("Access asserted triples from a URL");
    fileOpenTriplesUrl.addActionListener(new FileAssertedTriplesUrlOpenListener());
    fileAssertionsMenu.add(fileOpenTriplesUrl);

    fileAssertionsMenu.addSeparator();

    // Create menu options to open recently accessed ontology files
    fileOpenRecentTriplesFile = new JMenuItem[recentAssertionsFiles.size()];
    for (int recentFileNumber = 0; recentFileNumber < recentAssertionsFiles.size(); ++recentFileNumber) {
        fileOpenRecentTriplesFile[recentFileNumber] = new JMenuItem(
                recentAssertionsFiles.get(recentFileNumber).getName());
        fileOpenRecentTriplesFile[recentFileNumber]
                .setToolTipText(recentAssertionsFiles.get(recentFileNumber).getAbsolutePath());
        fileOpenRecentTriplesFile[recentFileNumber]
                .addActionListener(new RecentAssertedTriplesFileOpenListener());
        fileAssertionsMenu.add(fileOpenRecentTriplesFile[recentFileNumber]);
    }

    if (fileOpenRecentTriplesFile.length > 0) {
        fileAssertionsMenu.addSeparator();
    }

    fileSaveTriplesToFile = new JMenuItem("Save Assertions Text");
    fileSaveTriplesToFile
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK));
    fileSaveTriplesToFile.setMnemonic(KeyEvent.VK_S);
    fileSaveTriplesToFile.setToolTipText("Write the asserted triples to a file");
    fileSaveTriplesToFile.addActionListener(new FileAssertedTriplesSaveListener());
    fileAssertionsMenu.add(fileSaveTriplesToFile);

    fileSaveSerializedModel = new JMenuItem("Save Model (processed triples)");
    fileSaveSerializedModel
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK));
    fileSaveSerializedModel.setMnemonic(KeyEvent.VK_M);
    fileSaveSerializedModel.setToolTipText("Write the triples from the current model to a file");
    fileSaveSerializedModel.addActionListener(new ModelSerializerListener());
    fileAssertionsMenu.add(fileSaveSerializedModel);

    fileAssertionsMenu.addSeparator();

    fileExit = new JMenuItem("Exit");
    fileExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
    fileExit.setMnemonic(KeyEvent.VK_X);
    fileExit.setToolTipText("Exit the application");
    fileExit.addActionListener(new EndApplicationListener());
    fileAssertionsMenu.add(fileExit);

}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Configures the SPARQL file menu. Called at startup
 * and whenever an SPARQL file is opened or saved since
 * the list of recent SPARQL files is presented on the
 * file menu./*from w ww  .  java  2 s.c om*/
 */
private void setupSparqlFileMenu() {
    fileSparqlMenu.removeAll();

    fileOpenSparqlFile = new JMenuItem("Open SPARQL File");
    fileOpenSparqlFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.ALT_MASK));
    fileOpenSparqlFile.setMnemonic(KeyEvent.VK_S);
    fileOpenSparqlFile.setToolTipText("Open a SPARQL query file");
    fileOpenSparqlFile.addActionListener(new FileSparqlOpenListener());
    fileSparqlMenu.add(fileOpenSparqlFile);

    fileSparqlMenu.addSeparator();

    // Create menu options to open recently accessed SPARQL files
    fileOpenRecentSparqlFile = new JMenuItem[recentSparqlFiles.size()];
    for (int recentFileNumber = 0; recentFileNumber < recentSparqlFiles.size(); ++recentFileNumber) {
        fileOpenRecentSparqlFile[recentFileNumber] = new JMenuItem(
                recentSparqlFiles.get(recentFileNumber).getName());
        fileOpenRecentSparqlFile[recentFileNumber]
                .setToolTipText(recentSparqlFiles.get(recentFileNumber).getAbsolutePath());
        fileOpenRecentSparqlFile[recentFileNumber].addActionListener(new RecentSparqlFileOpenListener());
        fileSparqlMenu.add(fileOpenRecentSparqlFile[recentFileNumber]);
    }

    if (fileOpenRecentSparqlFile.length > 0) {
        fileSparqlMenu.addSeparator();
    }

    fileSaveSparqlQueryToFile = new JMenuItem("Save SPARQL Query");
    fileSaveSparqlQueryToFile
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK));
    fileSaveSparqlQueryToFile.setMnemonic(KeyEvent.VK_Q);
    fileSaveSparqlQueryToFile.setToolTipText("Write the SPARQL query to a file");
    fileSaveSparqlQueryToFile.addActionListener(new FileSparqlSaveListener());
    fileSparqlMenu.add(fileSaveSparqlQueryToFile);

    fileSaveSparqlResultsToFile = new JMenuItem("Save SPARQL Results");
    fileSaveSparqlResultsToFile
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK));
    fileSaveSparqlResultsToFile.setMnemonic(KeyEvent.VK_R);
    fileSaveSparqlResultsToFile.setToolTipText("Write the current SPARQL results to a file");
    fileSaveSparqlResultsToFile.addActionListener(new FileSparqlResultsSaveListener());
    fileSparqlMenu.add(fileSaveSparqlResultsToFile);

    fileSparqlMenu.addSeparator();

    fileClearSparqlHistory = new JMenuItem("Clear SPARQL Query History");
    fileClearSparqlHistory.setMnemonic(KeyEvent.VK_C);
    fileClearSparqlHistory.setToolTipText("Clear the history of executed SPARQL queries");
    fileClearSparqlHistory.addActionListener(new FileClearSparqlHistoryListener());
    fileSparqlMenu.add(fileClearSparqlHistory);

}

From source file:org.gtdfree.GTDFree.java

/**
 * This method initializes jMenuItem   // ww  w . 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:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Setup the frame's menus/*  w w w. java 2  s .  c  o  m*/
 */
private void setupMenus() {
    JMenuBar menuBar;

    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // Assertions file menu
    fileAssertionsMenu = new JMenu("File (Assertions)");
    fileAssertionsMenu.setMnemonic(KeyEvent.VK_A);
    fileAssertionsMenu.setToolTipText("Menu items related to asserted triples file access");
    menuBar.add(fileAssertionsMenu);

    setupAssertionsFileMenu();

    // SPARQL file menu
    fileSparqlMenu = new JMenu("File (SPARQL)");
    fileSparqlMenu.setMnemonic(KeyEvent.VK_S);
    fileSparqlMenu.setToolTipText("Menu items related to SPARQL file access");
    menuBar.add(fileSparqlMenu);

    setupSparqlFileMenu();

    // Edit Menu
    menuBar.add(setupEditMenu());

    // Configuration Menu
    menuBar.add(setupConfigurationMenu());

    // Model Menu
    menuBar.add(setupModelMenu());

    // Filters Menu
    menuBar.add(setupFiltersMenu());

    // SPARQL Server Menu
    menuBar.add(setupSparqlServerMenu());

    // Help Menu
    menuBar.add(setupHelpMenu());
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the edit menu//  w  ww  . ja v  a 2s.  c o m
 * 
 * @return The edit menu
 */
private JMenu setupEditMenu() {
    final JMenu menu = new JMenu("Edit");

    menu.setMnemonic(KeyEvent.VK_E);
    menu.setToolTipText("Menu items related to editing the ontology");

    editFind = new JMenuItem("Find (in assertions)");
    editFind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK));
    editFind.setMnemonic(KeyEvent.VK_F);
    editFind.setToolTipText("Find text in the assertions editor");
    editFind.addActionListener(new FindAssertionsTextListener());
    menu.add(editFind);

    editFindNextMatch = new JMenuItem("Next (matching assertion text)");
    editFindNextMatch.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK));
    editFindNextMatch.setMnemonic(KeyEvent.VK_N);
    editFindNextMatch.setToolTipText("Find next text match in the assertions editor");
    editFindNextMatch.addActionListener(new FindNextAssertionsTextListener());
    menu.add(editFindNextMatch);

    menu.addSeparator();

    editCommentToggle = new JMenuItem("Toggle Comment");
    editCommentToggle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK));
    editCommentToggle.setMnemonic(KeyEvent.VK_T);
    editCommentToggle
            .setToolTipText("Switch the chosen assertion or query lines between commented and not commented");
    editCommentToggle.addActionListener(new CommentToggleListener());
    editCommentToggle.setEnabled(false);
    menu.add(editCommentToggle);

    editInsertPrefixes = new JMenuItem("Insert Prefixes");
    editInsertPrefixes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));
    editInsertPrefixes.setMnemonic(KeyEvent.VK_I);
    editInsertPrefixes.setToolTipText("Insert standard prefixes (namespaces)");
    editInsertPrefixes.addActionListener(new InsertPrefixesListener());
    menu.add(editInsertPrefixes);

    menu.addSeparator();

    editExpandAllTreeNodes = new JMenuItem("Expand Entire Tree");
    editExpandAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, ActionEvent.ALT_MASK));
    editExpandAllTreeNodes.setMnemonic(KeyEvent.VK_E);
    editExpandAllTreeNodes.setToolTipText("Expand all tree nodes");
    editExpandAllTreeNodes.addActionListener(new ExpandTreeListener());
    menu.add(editExpandAllTreeNodes);

    editCollapseAllTreeNodes = new JMenuItem("Collapse Entire Tree");
    editCollapseAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, ActionEvent.ALT_MASK));
    editCollapseAllTreeNodes.setMnemonic(KeyEvent.VK_C);
    editCollapseAllTreeNodes.setToolTipText("Expand all tree nodes");
    editCollapseAllTreeNodes.addActionListener(new CollapseTreeListener());
    menu.add(editCollapseAllTreeNodes);

    menu.addSeparator();

    editEditListOfSparqlServiceUrls = new JMenuItem("Edit SPARQL Service URLs List");
    editEditListOfSparqlServiceUrls.setMnemonic(KeyEvent.VK_S);
    editEditListOfSparqlServiceUrls.setToolTipText("Remove unwanted URLs from the dropdown list");
    editEditListOfSparqlServiceUrls.addActionListener(new EditListOfSparqlServiceUrls());
    menu.add(editEditListOfSparqlServiceUrls);

    return menu;
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jButton   // w w w  .j ava2  s . c  o  m
 *    
 * @return javax.swing.JButton   
 */
private JButton getJButton() {
    if (jButton == null) {
        jButton = new JButton("Save");
        if (specimen.isStateDone()) {
            jButton.setEnabled(false);
            jButton.setText("Migrated " + specimen.getLoadFlags());
        }
        jButton.setMnemonic(KeyEvent.VK_S);
        jButton.setToolTipText(
                "Save changes to this record to the database.  No fields should have red backgrounds before you save.");
        jButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    thisPane.getParent().getParent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                } catch (Exception ex) {
                    log.error(ex);
                }

                save();

                ((CollectorTableModel) jTableCollectors.getModel()).fireTableDataChanged();
                ((NumberTableModel) jTableNumbers.getModel()).fireTableDataChanged();

                try {
                    thisPane.getParent().getParent()
                            .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                } catch (Exception ex) {
                    log.error(ex);
                }
            }
        });
    }
    return jButton;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the SPARQL server menu//w ww .j ava2  s .  com
 * 
 * @return The SPARQL server menu
 */
private JMenu setupSparqlServerMenu() {
    final JMenu menu = new JMenu("SPARQL Server");

    menu.setMnemonic(KeyEvent.VK_P);
    menu.setToolTipText("Options for using the SPARQL server");

    sparqlServerStartup = new JMenuItem("Startup SPARQL Server");
    sparqlServerStartup.setMnemonic(KeyEvent.VK_S);
    sparqlServerStartup.setToolTipText("Start the SPARQL server");
    sparqlServerStartup.addActionListener(new SparqlServerStartupListener());
    menu.add(sparqlServerStartup);

    sparqlServerShutdown = new JMenuItem("Shutdown SPARQL Server");
    sparqlServerShutdown.setMnemonic(KeyEvent.VK_H);
    sparqlServerShutdown.setToolTipText("Stop the SPARQL server");
    sparqlServerShutdown.addActionListener(new SparqlServerShutdownListener());
    menu.add(sparqlServerShutdown);

    menu.addSeparator();

    sparqlServerPublishCurrentModel = new JMenuItem("Publish Current Reasoned Model");
    sparqlServerPublishCurrentModel.setMnemonic(KeyEvent.VK_P);
    sparqlServerPublishCurrentModel
            .setToolTipText("Set the model for the SPARQL server to the current one reasoned");
    sparqlServerPublishCurrentModel.addActionListener(new SparqlServerPublishModelListener());
    menu.add(sparqlServerPublishCurrentModel);

    menu.addSeparator();

    sparqlServerConfig = new JMenuItem("Configure the SPARQL Server");
    sparqlServerConfig.setMnemonic(KeyEvent.VK_C);
    sparqlServerConfig.setToolTipText("Configure the server endpoint");
    sparqlServerConfig.addActionListener(new SparqlServerConfigurationListener());
    menu.add(sparqlServerConfig);

    return menu;
}

From source file:com.projity.pm.graphic.frames.GraphicManager.java

public void setToolBarAndMenus(final Container contentPane) {
    JToolBar toolBar;/*from   ww w .j a  va2  s  .c om*/
    if (Environment.isRibbonUI()) {
        if (Environment.isNeedToRestart()) {
            contentPane.add(new JLabel(Messages.getString("Error.restart")), BorderLayout.CENTER);
            return;
        }

        setRibbon((JRibbonFrame) container, getMenuManager());

        //         JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR_WITH_NO_SUB_VIEW_OPTION);
        //         topTabs = new TabbedNavigation();
        //         JComponent tabs = topTabs.createContentPanel(getMenuManager(),viewToolBar,0,JTabbedPane.TOP,true);
        //         tabs.setAlignmentX(0.0f); // so it is left justified
        //
        //
        //          Box top = new Box(BoxLayout.Y_AXIS);
        //          JComponent bottom;
        //         top.add(tabs);
        //         bottom = new TabbedNavigation().createContentPanel(getMenuManager(),viewToolBar,1,JTabbedPane.BOTTOM,false);
        //         contentPane.add(top, BorderLayout.BEFORE_FIRST_LINE);
        //         contentPane.add(bottom,BorderLayout.AFTER_LAST_LINE);
        //         if (Environment.isNewLaf())
        //            contentPane.setBackground(Color.WHITE);

        //         if (Environment.isMac()){
        //            //System.setProperty("apple.laf.useScreenMenuBar","true");
        //            //System.setProperty("com.apple.mrj.application.apple.menu.about.name", Messages.getMetaString("Text.ShortTitle"));
        //            JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone()?MenuManager.MAC_STANDARD_MENU:MenuManager.SERVER_STANDARD_MENU);
        //            //((JComponent)menu).setBorder(BorderFactory.createEmptyBorder());
        //
        //            ((JFrame)container).setJMenuBar(menu);
        //            projectListMenu = (JMenu) menu.getComponent(5);
        //         }

    } else if (Environment.isNewLook()) {
        if (Environment.isNeedToRestart()) {
            contentPane.add(new JLabel(Messages.getString("Error.restart")), BorderLayout.CENTER);
            return;
        }

        toolBar = getMenuManager().getToolBar(MenuManager.BIG_TOOL_BAR);
        if (!getLafManager().isToolbarOpaque())
            toolBar.setOpaque(false);
        if (!isApplet())
            getMenuManager().setActionVisible(ACTION_FULL_SCREEN, false);

        if (Environment.isExternal()) // external users only see project team
            getMenuManager().setActionVisible(ACTION_TEAM_FILTER, false);

        toolBar.addSeparator(new Dimension(20, 20));
        toolBar.add(new Box.Filler(new Dimension(0, 0), new Dimension(0, 0),
                new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)));
        toolBar.add(((DefaultFrameManager) getFrameManager()).getProjectComboPanel());
        toolBar.add(Box.createRigidArea(new Dimension(20, 20)));
        if (Environment.isNewLaf())
            toolBar.setBackground(Color.WHITE);
        toolBar.setFloatable(false);
        toolBar.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        Box top;
        JComponent bottom;

        top = new Box(BoxLayout.Y_AXIS);
        toolBar.setAlignmentX(0.0f); // so it is left justified
        top.add(toolBar);

        JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR_WITH_NO_SUB_VIEW_OPTION);
        topTabs = new TabbedNavigation();
        JComponent tabs = topTabs.createContentPanel(getMenuManager(), viewToolBar, 0, JTabbedPane.TOP, true);
        tabs.setAlignmentX(0.0f); // so it is left justified

        top.add(tabs);
        bottom = new TabbedNavigation().createContentPanel(getMenuManager(), viewToolBar, 1, JTabbedPane.BOTTOM,
                false);
        contentPane.add(top, BorderLayout.BEFORE_FIRST_LINE);
        contentPane.add(bottom, BorderLayout.AFTER_LAST_LINE);
        if (Environment.isNewLaf())
            contentPane.setBackground(Color.WHITE);

        if (Environment.isMac()) {
            //System.setProperty("apple.laf.useScreenMenuBar","true");
            //System.setProperty("com.apple.mrj.application.apple.menu.about.name", Messages.getMetaString("Text.ShortTitle"));
            JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone() ? MenuManager.MAC_STANDARD_MENU
                    : MenuManager.SERVER_STANDARD_MENU);
            //((JComponent)menu).setBorder(BorderFactory.createEmptyBorder());

            ((JFrame) container).setJMenuBar(menu);
            projectListMenu = (JMenu) menu.getComponent(5);
        }

    } else {

        toolBar = getMenuManager().getToolBar(
                Environment.isMac() ? MenuManager.MAC_STANDARD_TOOL_BAR : MenuManager.STANDARD_TOOL_BAR);
        filterToolBarManager = FilterToolBarManager.create(getMenuManager());
        filterToolBarManager.addButtons(toolBar);
        contentPane.add(toolBar, BorderLayout.BEFORE_FIRST_LINE);
        JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR);
        viewToolBar.setOrientation(JToolBar.VERTICAL);
        viewToolBar.setRollover(true);
        contentPane.add(viewToolBar, BorderLayout.WEST);

        JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone()
                ? (Environment.isMac() ? MenuManager.MAC_STANDARD_MENU : MenuManager.STANDARD_MENU)
                : MenuManager.SERVER_STANDARD_MENU);

        if (!Environment.isMac()) {
            ((JComponent) menu).setBorder(BorderFactory.createEmptyBorder());
            JMenuItem logo = (JMenuItem) menu.getComponent(0);
            logo.setBorder(BorderFactory.createEmptyBorder());
            logo.setMaximumSize(new Dimension(124, 52));
            logo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }
        ((JFrame) container).setJMenuBar(menu);
        projectListMenu = (JMenu) menu.getComponent(Environment.isMac() ? 5 : 6);
    }

    //accelerators
    addCtrlAccel(KeyEvent.VK_G, ACTION_GOTO, null);
    addCtrlAccel(KeyEvent.VK_L, ACTION_GOTO, null);
    addCtrlAccel(KeyEvent.VK_F, ACTION_FIND, null);
    addCtrlAccel(KeyEvent.VK_Z, ACTION_UNDO, null); //- Sanhita
    addCtrlAccel(KeyEvent.VK_Y, ACTION_REDO, null);
    addCtrlAccel(KeyEvent.VK_N, ACTION_NEW_PROJECT, null);
    addCtrlAccel(KeyEvent.VK_O, ACTION_OPEN_PROJECT, null);
    addCtrlAccel(KeyEvent.VK_S, ACTION_SAVE_PROJECT, null);
    addCtrlAccel(KeyEvent.VK_P, ACTION_PRINT, null); //-Sanhita
    addCtrlAccel(KeyEvent.VK_I, ACTION_INSERT_TASK, null);
    addCtrlAccel(KeyEvent.VK_PERIOD, ACTION_INDENT, null);
    addCtrlAccel(KeyEvent.VK_COMMA, ACTION_OUTDENT, null);
    addCtrlAccel(KeyEvent.VK_PLUS, ACTION_EXPAND, new ExpandAction());
    addCtrlAccel(KeyEvent.VK_ADD, ACTION_EXPAND, new ExpandAction());
    addCtrlAccel(KeyEvent.VK_EQUALS, ACTION_EXPAND, new ExpandAction());
    addCtrlAccel(KeyEvent.VK_MINUS, ACTION_COLLAPSE, new CollapseAction());
    addCtrlAccel(KeyEvent.VK_SUBTRACT, ACTION_COLLAPSE, new CollapseAction());

    // To force a recalculation. This normally shouldn't be needed.
    addCtrlAccel(KeyEvent.VK_R, ACTION_RECALCULATE, new RecalculateAction());
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Adds a 'standard' Save key binding for a Save component (i.e. <ctrl>S for Windows).
 * @param saveComp the component (usually a JButton)
 * @param saveAction the action to be invoked
 *///from w w w.  j a v  a  2 s.  com
public static void addSaveKeyBinding(final JComponent saveComp, final Action saveAction) {
    /*String    ACTION_KEY = "SAVE";
    KeyStroke ctrlS      = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    InputMap  inputMap   = saveComp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
            
    inputMap.put(ctrlS, ACTION_KEY);
    ActionMap actionMap = saveComp.getActionMap();
    actionMap.put(ACTION_KEY, saveAction);*/
    addKeyBinding(saveComp, saveAction, "SAVE", KeyEvent.VK_S,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
}