Example usage for java.awt.event ActionEvent CTRL_MASK

List of usage examples for java.awt.event ActionEvent CTRL_MASK

Introduction

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

Prototype

int CTRL_MASK

To view the source code for java.awt.event ActionEvent CTRL_MASK.

Click Source Link

Document

The control modifier.

Usage

From source file:org.tinymediamanager.ui.movies.MoviePanel.java

private void buildMenu() {
    menu.setMnemonic(KeyEvent.VK_M);

    // menu items
    JMenuItem menuItem = menu.add(actionUpdateDataSources2);
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.setAccelerator(//from  w  ww  .  ja  v  a2  s  . com
            KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    final JMenu menuUpdateDatasources = new JMenu(BUNDLE.getString("update.datasource")); //$NON-NLS-1$
    final JMenu menuFindMissingMovies = new JMenu(BUNDLE.getString("movie.findmissing")); //$NON-NLS-1$
    menuUpdateDatasources.addMenuListener(new MenuListener() {
        @Override
        public void menuCanceled(MenuEvent arg0) {
        }

        @Override
        public void menuDeselected(MenuEvent arg0) {
        }

        @Override
        public void menuSelected(MenuEvent arg0) {
            menuUpdateDatasources.removeAll();
            menuFindMissingMovies.removeAll();
            for (String ds : MovieModuleManager.MOVIE_SETTINGS.getMovieDataSource()) {
                JMenuItem item = new JMenuItem(new MovieUpdateSingleDatasourceAction(ds));
                menuUpdateDatasources.add(item);

                item = new JMenuItem(new MovieFindMissingAction(ds));
                menuFindMissingMovies.add(item);

            }
        }
    });
    menu.add(menuUpdateDatasources);

    menu.add(new MovieFindMissingAction());
    menu.add(menuFindMissingMovies);
    menu.add(new MovieCreateOfflineAction(true));

    menu.addSeparator();

    JMenu menuScrape = new JMenu(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$
    menuScrape.setMnemonic(KeyEvent.VK_S);
    menuItem = menuScrape.add(actionScrape2);
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuScrape.add(actionScrapeSelected);
    menuItem.setMnemonic(KeyEvent.VK_F);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuScrape.add(actionScrapeUnscraped);
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuScrape.add(actionScrapeMetadataSelected);
    menuItem.setMnemonic(KeyEvent.VK_M);
    menuScrape.add(actionAssignMovieSets);
    menu.add(menuScrape);

    JMenu menuEdit = new JMenu(BUNDLE.getString("Button.edit")); //$NON-NLS-1$
    menuEdit.setMnemonic(KeyEvent.VK_E);
    menuItem = menuEdit.add(actionEditMovie2);
    menuItem.setMnemonic(KeyEvent.VK_E);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionBatchEdit);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionSetWatchedFlag);
    menuItem.setMnemonic(KeyEvent.VK_W);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionRename2);
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionRenamerPreview);
    menuItem.setMnemonic(KeyEvent.VK_P);
    menu.add(menuEdit);

    menuItem = menu.add(actionRewriteNfo);
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem = menu.add(actionTrailerDownload);
    menuItem = menu.add(actionSearchSubtitle);
    menuItem = menu.add(actionDownloadSubtitle);

    menu.addSeparator();
    menuItem = menu.add(actionMediaInformation2);
    menuItem.setMnemonic(KeyEvent.VK_M);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menu.add(actionExport);
    menuItem.setMnemonic(KeyEvent.VK_X);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menu.add(actionRemove2);
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.setAccelerator(KeyStroke.getKeyStroke((char) KeyEvent.VK_DELETE));
    menuItem = menu.add(actionDelete2);
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, ActionEvent.SHIFT_MASK));
    menu.addSeparator();
    menuItem = menu.add(actionSyncTrakt);
    menuItem.setMnemonic(KeyEvent.VK_T);
    menuItem = menu.add(actionSyncWatchedTrakt);
    menuItem.setMnemonic(KeyEvent.VK_W);
    menuItem = menu.add(actionSyncSelectedTrakt);

    menu.addSeparator();
    menuItem = menu.add(actionClearImageCache);
    menuItem.setMnemonic(KeyEvent.VK_C);

    // popup menu
    JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.add(actionScrape2);
    popupMenu.add(actionScrapeSelected);
    popupMenu.add(actionScrapeUnscraped);
    popupMenu.add(actionScrapeMetadataSelected);
    popupMenu.add(actionAssignMovieSets);
    popupMenu.addSeparator();
    popupMenu.add(actionEditMovie2);
    popupMenu.add(actionBatchEdit);
    popupMenu.add(actionSetWatchedFlag);
    popupMenu.add(actionRewriteNfo);
    popupMenu.add(actionRename2);
    popupMenu.add(actionRenamerPreview);
    popupMenu.add(actionMediaInformation2);
    popupMenu.add(actionExport);
    popupMenu.add(actionTrailerDownload);
    popupMenu.add(actionSearchSubtitle);
    popupMenu.add(actionDownloadSubtitle);
    popupMenu.addSeparator();
    popupMenu.add(actionSyncTrakt);
    popupMenu.add(actionSyncWatchedTrakt);
    popupMenu.add(actionSyncSelectedTrakt);
    popupMenu.addSeparator();
    popupMenu.add(actionClearImageCache);
    popupMenu.addSeparator();
    popupMenu.add(actionRemove2);
    popupMenu.add(actionDelete2);

    if (Globals.isDebug()) {
        JMenu menuDebug = new JMenu("Debug"); //$NON-NLS-1$
        menuDebug.add(debugDumpMovie);
        menuDebug.addSeparator();
        menuDebug.add(new FakeTmmTaskAction("download", 1, 10));
        menuDebug.add(new FakeTmmTaskAction("download", 10, 10));
        menuDebug.add(new FakeTmmTaskAction("image", 1, 10));
        menuDebug.add(new FakeTmmTaskAction("image", 10, 10));
        menuDebug.add(new FakeTmmTaskAction("unnamed", 1, 10));
        menuDebug.add(new FakeTmmTaskAction("unnamed", 10, 10));
        popupMenu.add(menuDebug);
    }

    MouseListener mouseListener = new MovieTableMouseListener(popupMenu, table);
    table.addMouseListener(mouseListener);
}

From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java

/**
 * Builds the menu./*from  ww w  .ja v a  2  s  .  co m*/
 */
private void buildMenu() {
    menu.setMnemonic(KeyEvent.VK_V);

    // menu items
    JMenuItem menuItem = menu.add(actionUpdateDatasources2);
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menu.addSeparator();

    JMenu menuScrape = new JMenu(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$
    menuScrape.setMnemonic(KeyEvent.VK_S);
    menuItem = menuScrape.add(actionScrape2);
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuScrape.add(actionScrapeSelected);
    menuItem.setMnemonic(KeyEvent.VK_F);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuScrape.add(actionScrapeNewItems);
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menu.add(menuScrape);

    JMenu menuEdit = new JMenu(BUNDLE.getString("Button.edit")); //$NON-NLS-1$
    menuEdit.setMnemonic(KeyEvent.VK_E);
    menuItem = menuEdit.add(actionEdit2);
    menuItem.setMnemonic(KeyEvent.VK_E);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionBatchEdit);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionSetWatchedFlag);
    menuItem.setMnemonic(KeyEvent.VK_W);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menuEdit.add(actionChangeSeasonPoster2);
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuEdit.add(actionChangeToDvdOrder);
    menuEdit.add(actionChangeToAiredOrder);

    menu.add(menuEdit);
    menu.add(actionRewriteTvShowNfo);
    menu.add(actionRewriteTvShowEpisodeNfo);

    menuItem = menu.add(actionRename);
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menu.add(actionMediaInformation2);
    menuItem.setMnemonic(KeyEvent.VK_M);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menu.add(actionExport);
    menuItem.setMnemonic(KeyEvent.VK_X);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
    menuItem = menu.add(actionClearImageCache);
    menuItem.setMnemonic(KeyEvent.VK_C);

    menu.addSeparator();
    menuItem = menu.add(actionRemove2);
    menuItem.setAccelerator(KeyStroke.getKeyStroke((char) KeyEvent.VK_DELETE));
    menuItem = menu.add(actionDelete2);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, ActionEvent.SHIFT_MASK));

    menu.addSeparator();
    menuItem = menu.add(actionSyncTrakt);
    menuItem.setMnemonic(KeyEvent.VK_T);
    menuItem = menu.add(actionSyncWatchedTrakt);
    menuItem.setMnemonic(KeyEvent.VK_W);
    menuItem = menu.add(actionSyncSelectedTrakt);

    // popup menu
    JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.add(actionScrape2);
    popupMenu.add(actionScrapeSelected);
    popupMenu.add(actionScrapeEpisodes);
    popupMenu.add(actionScrapeEpisodes2);
    popupMenu.add(actionScrapeNewItems);
    // popupMenu.add(actionScrapeMetadataSelected);
    popupMenu.addSeparator();
    popupMenu.add(actionUpdateTvShow);
    popupMenu.addSeparator();
    popupMenu.add(actionEdit2);
    popupMenu.add(actionChangeSeasonPoster2);
    popupMenu.add(actionBatchEdit);
    popupMenu.add(actionSetWatchedFlag);
    popupMenu.add(actionChangeToDvdOrder);
    popupMenu.add(actionChangeToAiredOrder);
    popupMenu.add(actionRewriteTvShowNfo);
    popupMenu.add(actionRewriteTvShowEpisodeNfo);
    // popupMenu.add(actionBatchEdit);
    popupMenu.add(actionRename);
    popupMenu.add(actionMediaInformation2);
    popupMenu.add(actionExport);
    popupMenu.add(actionClearImageCache);
    popupMenu.addSeparator();
    popupMenu.add(actionDownloadSubtitles);
    popupMenu.add(actionSearchAndDownloadSubtitles);
    popupMenu.addSeparator();
    popupMenu.add(actionSyncTrakt);
    popupMenu.add(actionSyncWatchedTrakt);
    popupMenu.add(actionSyncSelectedTrakt);
    popupMenu.addSeparator();
    popupMenu.add(actionRemove2);
    popupMenu.add(actionDelete2);
    popupMenu.addSeparator();
    popupMenu.add(new ExpandAllAction());
    popupMenu.add(new CollapseAllAction());

    if (Globals.isDebug()) {
        JMenu menuDebug = new JMenu("Debug"); //$NON-NLS-1$
        menuDebug.add(debugDumpShow);
        popupMenu.addSeparator();
        popupMenu.add(menuDebug);
    }

    MouseListener popupListener = new TreePopupListener(popupMenu, tree);
    tree.addMouseListener(popupListener);
}

From source file:Samples.Advanced.GraphEditorDemo.java

/**
 * a driver for this demo//from  w  w  w .j  av a2  s  . c  o  m
 */
@SuppressWarnings("serial")
public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final GraphEditorDemo demo = new GraphEditorDemo();

    JMenu menu = new JMenu("File");
    menu.add(new AbstractAction("Make Image") {
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            int option = chooser.showSaveDialog(demo);
            if (option == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                demo.writeJPEGImage(file);
            }
        }
    });
    menu.add(new AbstractAction("Print") {
        public void actionPerformed(ActionEvent e) {
            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setPrintable(demo);
            if (printJob.printDialog()) {
                try {
                    printJob.print();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    });
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(menu);
    JMenu matrixMenu = new JMenu();
    matrixMenu.setText("Matrix");
    matrixMenu.setIcon(null);
    matrixMenu.setPreferredSize(new Dimension(80, 20));
    menuBar.add(matrixMenu);
    JMenuItem copyMatrix = new JMenuItem("Copy Matrix to clipboard", KeyEvent.VK_C);
    copyMatrix.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
    menuBar.add(copyMatrix);
    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(demo);
    copyMatrix.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            Vem textTransfer = new Vem();

            //Set up Matrix
            List<Integer[]> graphMatrix = new ArrayList<Integer[]>();
            int MatrixSize = graph.getVertexCount();

            Integer[] activeV = new Integer[MatrixSize];
            int count = 0;
            int activeVPos = 0;

            while (activeVPos < MatrixSize) {
                if (graph.containsVertex(count)) {
                    activeV[activeVPos] = count;
                    activeVPos++;
                }
                count++;
            }

            // sgv.g.getVertices().toArray()  ((Integer[])(sgv.g.getVertices().toArray()))
            for (int i = 0; i < MatrixSize; i++) {
                Integer[] tempArray = new Integer[MatrixSize];
                for (int j = 0; j < MatrixSize; j++) {
                    if (graph.findEdge(activeV[i], activeV[j]) != null) {
                        tempArray[j] = 1;
                    } else {
                        tempArray[j] = 0;
                    }
                }
                graphMatrix.add(tempArray);
            }
            //graphMatrix.add(new Integer[]{1, 2, 3});
            //graphMatrix.add(new Integer[]{4, 5 , 6, 7});

            //System.out.println(matrixToString(graphMatrix));
            //System.out.println(matrixToMathematica(graphMatrix));

            textTransfer.setClipboardContents("" + matrixToMathematica(graphMatrix));
            System.out.println("Clipboard contains:" + textTransfer.getClipboardContents());
        }
    });

    frame.pack();
    frame.setVisible(true);
}

From source file:storybook.toolkit.swing.SwingUtil.java

public static KeyStroke getKeyStrokeCopy() {
    return KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false);
}