Example usage for java.awt.event KeyEvent VK_K

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

Introduction

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

Prototype

int VK_K

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

Click Source Link

Document

Constant for the "K" key.

Usage

From source file:savant.view.swing.Savant.java

private void initMenu() {
    loadGenomeItem.setAccelerator(/*from ww  w.ja v  a  2 s  .co m*/
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, MiscUtils.MENU_MASK));
    loadFromFileItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, MiscUtils.MENU_MASK));
    loadFromURLItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, MiscUtils.MENU_MASK));
    loadFromDataSourcePluginItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, MiscUtils.MENU_MASK));
    openProjectItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, MiscUtils.MENU_MASK));
    saveProjectItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, MiscUtils.MENU_MASK));
    saveProjectAsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    formatItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, MiscUtils.MENU_MASK));
    exitItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, MiscUtils.MENU_MASK));
    undoItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, MiscUtils.MENU_MASK));
    redoItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, MiscUtils.MENU_MASK));
    bookmarkItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, MiscUtils.MENU_MASK));
    navigationItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.SHIFT_MASK | MiscUtils.MENU_MASK));
    panLeftItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT,
            java.awt.event.InputEvent.SHIFT_MASK));
    panRightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN,
            java.awt.event.InputEvent.SHIFT_MASK));
    toStartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_HOME,
            java.awt.event.InputEvent.SHIFT_MASK));
    toEndItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_END,
            java.awt.event.InputEvent.SHIFT_MASK));
    preferencesItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, MiscUtils.MENU_MASK));
    crosshairItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, MiscUtils.MENU_MASK));
    plumblineItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, MiscUtils.MENU_MASK));
    spotlightItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, MiscUtils.MENU_MASK));
    bookmarksItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    genomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    rulerItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    statusBarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    pluginToolbarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    exportItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, MiscUtils.MENU_MASK));

    if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
        tutorialsItem.setEnabled(false);
        userManualItem.setEnabled(false);
        websiteItem.setEnabled(false);
    }
    initBrowseMenu();
    try {
        RecentTracksController.getInstance().populateMenu(recentTrackMenu);
        RecentProjectsController.getInstance().populateMenu(recentProjectMenu);
    } catch (IOException ex) {
        LOG.error("Unable to populate Recent Items menu.", ex);
    }

}

From source file:xtrememp.XtremeMP.java

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

    // File Menu/* w ww.  j  a v a2  s  .c o m*/
    String fileMenuStr = tr("MainFrame.Menu.File");
    fileMenu = new JMenu(fileMenuStr);
    fileMenu.setMnemonic(fileMenuStr.charAt(0));

    openMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenFile"));
    openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));
    openMenuItem.setIcon(Utilities.FOLDER_ICON);
    openMenuItem.addActionListener(this);
    fileMenu.add(openMenuItem);

    openURLMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenURL"));
    openURLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK));
    openURLMenuItem.setIcon(Utilities.FOLDER_REMOTE_ICON);
    openURLMenuItem.addActionListener(this);
    fileMenu.add(openURLMenuItem);

    fileMenu.addSeparator();

    openPlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenPlaylist"));
    openPlaylistMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    openPlaylistMenuItem.setIcon(Utilities.DOCUMENT_OPEN_ICON);
    openPlaylistMenuItem.addActionListener(this);
    fileMenu.add(openPlaylistMenuItem);

    savePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.SavePlaylist"));
    savePlaylistMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    savePlaylistMenuItem.setIcon(Utilities.DOCUMENT_SAVE_ICON);
    savePlaylistMenuItem.addActionListener(this);
    fileMenu.add(savePlaylistMenuItem);

    fileMenu.addSeparator();

    preferencesMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Preferences"));
    preferencesMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK));
    preferencesMenuItem.addActionListener(this);
    fileMenu.add(preferencesMenuItem);

    fileMenu.addSeparator();

    exitMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Exit"));
    exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK));
    exitMenuItem.addActionListener(this);
    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    // Player Menu
    String playerMenuStr = tr("MainFrame.Menu.Player");
    playerMenu = new JMenu(playerMenuStr);
    playerMenu.setMnemonic(playerMenuStr.charAt(0));

    playPauseMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Play"));
    playPauseMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
    playPauseMenuItem.addActionListener(this);
    playerMenu.add(playPauseMenuItem);

    stopMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Stop"));
    stopMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK));
    //        stopMenuItem.setIcon(Utilities.MEDIA_STOP_ICON);
    stopMenuItem.setEnabled(false);
    stopMenuItem.addActionListener(this);
    playerMenu.add(stopMenuItem);

    previousMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Previous"));
    previousMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK));
    //        previousMenuItem.setIcon(Utilities.MEDIA_PREVIOUS_ICON);
    previousMenuItem.setEnabled(false);
    previousMenuItem.addActionListener(this);
    playerMenu.add(previousMenuItem);

    nextMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Next"));
    nextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK));
    //        nextMenuItem.setIcon(Utilities.MEDIA_NEXT_ICON);
    nextMenuItem.setEnabled(false);
    nextMenuItem.addActionListener(this);
    playerMenu.add(nextMenuItem);

    playerMenu.addSeparator();

    //PlayMode submenu
    String playModeSubMenuStr = tr("MainFrame.Menu.Player.PlayMode");
    playModeSubMenu = new JMenu(playModeSubMenuStr);

    playModeRepeatNoneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatNone"));
    playModeRepeatNoneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_NONE_ICON);
    playModeRepeatNoneMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatNoneMenuItem);
    playModeRepeatOneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatOne"));
    playModeRepeatOneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ONE_ICON);
    playModeRepeatOneMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatOneMenuItem);
    playModeRepeatAllMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatAll"));
    playModeRepeatAllMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ALL_ICON);
    playModeRepeatAllMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatAllMenuItem);
    playModeShuffleMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.Shuffle"));
    playModeShuffleMenuItem.setIcon(Utilities.PLAYLIST_SHUFFLE_ICON);
    playModeShuffleMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeShuffleMenuItem);

    ButtonGroup playModeBG = new ButtonGroup();
    playModeBG.add(playModeRepeatNoneMenuItem);
    playModeBG.add(playModeRepeatOneMenuItem);
    playModeBG.add(playModeRepeatAllMenuItem);
    playModeBG.add(playModeShuffleMenuItem);

    playerMenu.add(playModeSubMenu);
    playerMenu.addSeparator();

    randomizePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Randomize"));
    randomizePlaylistMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));
    randomizePlaylistMenuItem.setEnabled(false);
    randomizePlaylistMenuItem.addActionListener(this);
    playerMenu.add(randomizePlaylistMenuItem);

    menuBar.add(playerMenu);

    // View Menu
    String viewMenuStr = tr("MainFrame.Menu.View");
    viewMenu = new JMenu(viewMenuStr);
    viewMenu.setMnemonic(viewMenuStr.charAt(0));

    playlistManagerMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.PlaylistManager"));
    playlistManagerMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));
    playlistManagerMenuItem.addActionListener(this);
    viewMenu.add(playlistManagerMenuItem);

    visualizationMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.Visualizations"));
    visualizationMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK));
    visualizationMenuItem.addActionListener(this);
    viewMenu.add(visualizationMenuItem);

    ButtonGroup viewBG = new ButtonGroup();
    viewBG.add(playlistManagerMenuItem);
    viewBG.add(visualizationMenuItem);

    menuBar.add(viewMenu);

    // Help menu
    String helpMenuStr = tr("MainFrame.Menu.Help");
    helpMenu = new JMenu(helpMenuStr);
    helpMenu.setMnemonic(helpMenuStr.charAt(0));

    updateMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.CheckForUpdates"));
    updateMenuItem.addActionListener(this);
    helpMenu.add(updateMenuItem);
    helpMenu.addSeparator();

    aboutMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.About"));
    aboutMenuItem.addActionListener(this);
    helpMenu.add(aboutMenuItem);

    menuBar.add(helpMenu);

    menuBar.add(Box.createHorizontalGlue());
    busyLabel = new BusyLabel(new Dimension(20, 20));
    menuBar.add(busyLabel);
    menuBar.add(Box.createHorizontalStrut(8));

    mainFrame.setJMenuBar(menuBar);
}