Example usage for java.awt Event SHIFT_MASK

List of usage examples for java.awt Event SHIFT_MASK

Introduction

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

Prototype

int SHIFT_MASK

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

Click Source Link

Document

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

Usage

From source file:EventTester.java

private String mods(int flags) {
    String s = "[ ";
    if (flags == 0)
        return "";
    if ((flags & Event.SHIFT_MASK) != 0)
        s += "Shift ";
    if ((flags & Event.CTRL_MASK) != 0)
        s += "Control ";
    if ((flags & Event.META_MASK) != 0)
        s += "Meta ";
    if ((flags & Event.ALT_MASK) != 0)
        s += "Alt ";
    s += "] ";//from  w  w  w. j  a  v  a  2 s. com
    return s;
}

From source file:de.codesourcery.jasm16.ide.ui.views.SourceEditorView.java

@Override
protected final void setupKeyBindingsHook(final JTextPane editor) {
    // 'Rename' action 
    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.ALT_MASK | Event.SHIFT_MASK),
            new AbstractAction() {
                @Override//from   ww  w.ja  va2s .  co m
                public void actionPerformed(ActionEvent e) {
                    maybeRenameLabel(editor.getCaretPosition());
                }
            });
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initMenuBar() {
    JMenuBar menuBar = new JMenuBar();

    // File menu//from  w  w  w. ja va2 s .  co  m
    fileMenu = new JMenu("(F)");
    fileMenu.setMnemonic('F');

    exportMenuItem = new JMenuItem("(B)...");
    exportMenuItem.setIcon(new ImageIcon(getClass().getResource("database-save.png")));
    exportMenuItem.setMnemonic('B');
    exportMenuItem.addActionListener(e -> exportRecords());
    fileMenu.add(exportMenuItem);

    importMenuItem = new JMenuItem("??(R)...");
    importMenuItem.setIcon(new ImageIcon(getClass().getResource("document-import-2.png")));
    importMenuItem.setMnemonic('R');
    importMenuItem.addActionListener(e -> importRecords());
    fileMenu.add(importMenuItem);

    fileMenu.addSeparator();

    quitMenuItem = new JMenuItem("(X)");
    quitMenuItem.setIcon(new ImageIcon(getClass().getResource("application-exit-2.png")));
    quitMenuItem.setMnemonic('X');
    quitMenuItem.addActionListener(e -> quit());
    fileMenu.add(quitMenuItem);

    // View menu
    viewMenu = new JMenu("(V)");
    viewMenu.setMnemonic('V');

    searchMenuItem = new JMenuItem("?(S)");
    searchMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-find-5.png")));
    searchMenuItem.setMnemonic('S');
    searchMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    searchMenuItem.addActionListener(e -> searchRecords());
    viewMenu.add(searchMenuItem);

    keywordMenuItem = new JMenuItem("(K)");
    keywordMenuItem.setIcon(new ImageIcon(getClass().getResource("text-field.png")));
    keywordMenuItem.setMnemonic('K');
    keywordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK));
    keywordMenuItem.addActionListener(e -> {
        keywordTextField.requestFocus();
        keywordTextField.selectAll();
    });
    viewMenu.add(keywordMenuItem);

    viewMenu.addSeparator();

    prevPageMenuItem = new JMenuItem("?(P)");
    prevPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-previous-2.png")));
    prevPageMenuItem.setMnemonic('P');
    prevPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK));
    prevPageMenuItem.addActionListener(e -> prevPage());
    viewMenu.add(prevPageMenuItem);

    nextPageMenuItem = new JMenuItem("(N)");
    nextPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-next-2.png")));
    nextPageMenuItem.setMnemonic('N');
    nextPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK));
    nextPageMenuItem.addActionListener(e -> nextPage());
    viewMenu.add(nextPageMenuItem);

    firstPageMenuItem = new JMenuItem("(F)");
    firstPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-first.png")));
    firstPageMenuItem.setMnemonic('F');
    firstPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.SHIFT_MASK + Event.CTRL_MASK));
    firstPageMenuItem.addActionListener(e -> firstPage());
    viewMenu.add(firstPageMenuItem);

    lastPageMenuItem = new JMenuItem("(L)");
    lastPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-last.png")));
    lastPageMenuItem.setMnemonic('L');
    lastPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.SHIFT_MASK + Event.CTRL_MASK));
    lastPageMenuItem.addActionListener(e -> lastPage());
    viewMenu.add(lastPageMenuItem);

    // Edit menu
    editMenu = new JMenu("(E)");
    editMenu.setMnemonic('E');

    addRecordMenuItem = new JMenuItem("(A)...");
    addRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-add-3.png")));
    addRecordMenuItem.setMnemonic('A');
    addRecordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK));
    addRecordMenuItem.addActionListener(e -> showAddRecordDialog());
    editMenu.add(addRecordMenuItem);

    //        deleteRecordMenuItem = new JMenuItem("(D)");
    //        deleteRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-delete-6.png")));
    //        deleteRecordMenuItem.setMnemonic('D');
    //        deleteRecordMenuItem.addActionListener(e -> deleteRecord());
    //        editMenu.add(deleteRecordMenuItem);

    editMenu.addSeparator();

    categoryMenuItem = new JMenuItem("???(T)...");
    categoryMenuItem.setIcon(new ImageIcon(getClass().getResource("view-list-icons-2.png")));
    categoryMenuItem.setMnemonic('T');
    categoryMenuItem.addActionListener(e -> showCategoryDialog());
    editMenu.add(categoryMenuItem);

    // Help menu
    helpMenu = new JMenu("(H)");
    helpMenu.setMnemonic('H');

    helpMenuItem = new JMenuItem("(I)");
    helpMenuItem.setIcon(new ImageIcon(getClass().getResource("help-2.png")));
    helpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    helpMenuItem.setMnemonic('I');
    helpMenuItem.addActionListener(e -> help());
    helpMenu.add(helpMenuItem);

    aboutMenuItem = new JMenuItem("(A)");
    aboutMenuItem.setIcon(new ImageIcon(getClass().getResource("help-about-2.png")));
    aboutMenuItem.setMnemonic('A');
    aboutMenuItem.addActionListener(e -> about());
    helpMenu.add(aboutMenuItem);

    // Add menu to menu bar
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(viewMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
}

From source file:org.parosproxy.paros.view.OutputPanel.java

/**
 * This method initializes this//from   w ww . j a  v a  2s  . com
 */
private void initialize() {
    this.setLayout(new BorderLayout());
    this.setName(Constant.messages.getString("output.panel.title")); // ZAP: i18n
    if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        this.setSize(243, 119);
    }
    // ZAP: Added Output (doc) icon
    this.setIcon(new ImageIcon(OutputPanel.class.getResource("/resource/icon/16/172.png"))); // 'doc' icon
    this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false));
    this.setMnemonic(Constant.messages.getChar("output.panel.mnemonic"));

    this.add(getMainPanel(), BorderLayout.CENTER);
    this.setShowByDefault(true);
}

From source file:org.zaproxy.zap.extension.quickstart.QuickStartPanel.java

private void initialize() {
    this.setIcon(new ImageIcon(BreakPanel.class.getResource("/resource/icon/16/147.png"))); // 'lightning' icon
    this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false));
    this.setMnemonic(Constant.messages.getChar("quickstart.panel.mnemonic"));
    this.setLayout(new BorderLayout());

    JPanel panelContent = new JPanel(new GridBagLayout());
    JScrollPane jScrollPane = new JScrollPane();
    jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11));
    jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jScrollPane.setViewportView(panelContent);

    this.add(jScrollPane, BorderLayout.CENTER);

    panelContent.setBackground(Color.white);
    panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    /*//from   w  w w  .j av a 2  s. c  o  m
     * Layout:
     * Col            0                      1                      2                    3                       4
     * Row+----------------------+----------------------+----------------------+----------------------+----------------------+
     *  0 | Top welcome message                                                                       |    zap128x128.png    |
     *  1 | URL:                 | [ Url field                                                      ] |                      |
     *  2 |                      | [ Attack button ]    | [ Stop button ]      | padding              |                      |
     *  3 | Progress:            | Progress details                                                   |                      |
     *    | Bottom message                                                                                                   |
     *    | Show at start:       | [x]                  |                      |                      |                      |
     *    +----------------------+----------------------+----------------------+----------------------+----------------------+
     */

    panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.topmsg")),
            LayoutHelper.getGBC(0, 0, 4, 1.0D, new Insets(5, 5, 5, 5)));
    if (Constant.isDevBuild()) {
        panelContent.add(
                new JLabel(new ImageIcon(QuickStartPanel.class
                        .getResource("/org/zaproxy/zap/extension/quickstart/resources/zap128x128dark.png"))),
                LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH));
    } else {
        panelContent.add(
                new JLabel(DisplayUtils.getScaledIcon(
                        new ImageIcon(SearchPanel.class.getResource("/resource/zap128x128.png")))),
                LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH));
    }

    panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.url")),
            LayoutHelper.getGBC(0, 1, 1, 0.0D, new Insets(5, 5, 5, 5)));

    JPanel urlSelectPanel = new JPanel(new GridBagLayout());
    JButton selectButton = new JButton(Constant.messages.getString("all.button.select"));
    selectButton.setIcon(
            DisplayUtils.getScaledIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png")))); // Globe icon
    selectButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            NodeSelectDialog nsd = new NodeSelectDialog(View.getSingleton().getMainFrame());
            SiteNode node = null;
            try {
                node = Model.getSingleton().getSession().getSiteTree()
                        .findNode(new URI(getUrlField().getText(), false));
            } catch (Exception e2) {
                // Ignore
            }
            node = nsd.showDialog(node);
            if (node != null && node.getHistoryReference() != null) {
                try {
                    getUrlField().setText(node.getHistoryReference().getURI().toString());
                } catch (Exception e1) {
                    // Ignore
                }
            }
        }
    });

    urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 1.0D));
    urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D));
    panelContent.add(urlSelectPanel, LayoutHelper.getGBC(1, 1, 3, 0.25D));

    panelContent.add(this.getAttackButton(), LayoutHelper.getGBC(1, 2, 1, 0.0D));
    panelContent.add(this.getStopButton(), LayoutHelper.getGBC(2, 2, 1, 0.0D));
    panelContent.add(new JLabel(""), LayoutHelper.getGBC(3, 2, 1, 0.75D, 0.0D)); // Padding to right of buttons

    progressLabel = new JLabel(
            Constant.messages.getString("quickstart.progress." + AttackThread.Progress.notstarted.name()));
    panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.progress")),
            LayoutHelper.getGBC(0, 3, 1, 0.0D, new Insets(5, 5, 5, 5)));
    panelContent.add(this.progressLabel, LayoutHelper.getGBC(1, 3, 3, 0.0D));

    panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.proxymsg")),
            LayoutHelper.getGBC(0, 4, 5, 1.0D, new Insets(5, 5, 5, 5)));

    if (Control.getSingleton().getExtensionLoader().getExtension("ExtensionPlugNHack") != null) {
        // Plug-n-Hack extension has been installed - this makes configuration much easier :)
        if (DesktopUtils.canOpenUrlInBrowser()) {
            panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitm")),
                    LayoutHelper.getGBC(0, 6, 1, 0.0D, new Insets(5, 5, 5, 5)));
            panelContent.add(this.getConfButton(), LayoutHelper.getGBC(1, 6, 1, 0.0D));

            panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmalt")),
                    LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5)));
        } else {
            panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmurl")),
                    LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5)));
        }
        panelContent.add(this.getConfField(), LayoutHelper.getGBC(1, 7, 3, 0.25D));

    } else {
        panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.helpmsg")),
                LayoutHelper.getGBC(0, 5, 5, 1.0D, new Insets(5, 5, 5, 5)));

    }

    panelContent.add(new JLabel(""), LayoutHelper.getGBC(0, 10, 4, 1.D, 1.0D)); // Padding at bottom

    this.setMode(Control.getSingleton().getMode());
}

From source file:org.zaproxy.zap.extension.spiderAjax.SpiderPanel.java

/**
 * This method initializes this class and its attributes
 * /*from   w w  w.j  a  va2s. c om*/
 */
private void initialize() {
    this.setLayout(new BorderLayout());
    if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        this.setSize(600, 200);
    }
    this.add(getAJAXSpiderPanel(), java.awt.BorderLayout.CENTER);
    scanStatus = new ScanStatus(
            new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/spiderAjax.png")),
            this.extension.getMessages().getString("spiderajax.panel.title"));

    this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false));
    this.setMnemonic(Constant.messages.getChar("spiderajax.panel.mnemonic"));

    if (View.isInitialised()) {
        View.getSingleton().getMainFrame().getMainFooterPanel()
                .addFooterToolbarRightLabel(scanStatus.getCountLabel());
    }

}