Example usage for java.awt.event KeyEvent VK_H

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

Introduction

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

Prototype

int VK_H

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

Click Source Link

Document

Constant for the "H" key.

Usage

From source file:MnemonicSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Mnemonics");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = frame.getContentPane();
    content.setLayout(new GridLayout(1, 0));

    JButton button1 = new JButton("Warning");
    button1.setMnemonic(KeyEvent.VK_W);
    content.add(button1);//from w  w  w  . j a va 2s . co m

    JButton button2 = new JButton("Warning");
    button2.setMnemonic(KeyEvent.VK_H);
    content.add(button2);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:MenuSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Menu Glue Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JMenuBar bar = new JMenuBar();

    // File Menu, F - Mnemonic
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    bar.add(fileMenu);//  w w  w. j  a v  a 2 s .  c o m

    // Edit Menu, E - Mnemonic
    JMenu editMenu = new JMenu("Edit");
    editMenu.setMnemonic(KeyEvent.VK_E);
    bar.add(editMenu);

    // Move help menu to right side
    bar.add(Box.createHorizontalGlue());

    // Help Menu, H - Mnemonic
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    bar.add(helpMenu);

    frame.setJMenuBar(bar);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:AboutDialog.java

public static void main(String[] args) {
    JMenuBar menubar = new JMenuBar();

    JMenu file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);

    JMenu help = new JMenu("Help");
    help.setMnemonic(KeyEvent.VK_H);

    JMenuItem about = new JMenuItem("About");
    help.add(about);// ww  w.jav a  2 s .c om

    about.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            AboutDialog ad = new AboutDialog();
            ad.setVisible(true);
        }
    });

    menubar.add(file);
    menubar.add(help);
    JFrame f = new JFrame();
    f.setJMenuBar(menubar);

    f.setSize(300, 200);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:Main.java

private static void initHelpButton(final JButton buttonHelp) {
    buttonHelp.setMnemonic(KeyEvent.VK_H);
    buttonHelp.setDefaultCapable(false);
}

From source file:ca.sfu.federation.action.ShowHelpWebSiteAction.java

public ShowHelpWebSiteAction() {
    super("Online Help Documents", null);
    this.putValue(Action.LONG_DESCRIPTION, "Online Help Documents");
    this.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_H);
    this.putValue(Action.SHORT_DESCRIPTION, "Online Help Documents");
}

From source file:Main.java

/**
 * Returns the mnemonic integer./* www  .  j a va2 s. c  o  m*/
 * 
 * @param c The character (uppercase)
 * @return The mnemonic.
 */
@SuppressWarnings("incomplete-switch")
private static int setMnemonicsGet(char c) {
    int mnemonic = 0;
    switch (Character.toUpperCase(c)) {
    case '0':
        mnemonic = KeyEvent.VK_0;
        break;
    case '1':
        mnemonic = KeyEvent.VK_1;
        break;
    case '2':
        mnemonic = KeyEvent.VK_2;
        break;
    case '3':
        mnemonic = KeyEvent.VK_3;
        break;
    case '4':
        mnemonic = KeyEvent.VK_4;
        break;
    case '5':
        mnemonic = KeyEvent.VK_5;
        break;
    case '6':
        mnemonic = KeyEvent.VK_6;
        break;
    case '7':
        mnemonic = KeyEvent.VK_7;
        break;
    case '8':
        mnemonic = KeyEvent.VK_8;
        break;
    case '9':
        mnemonic = KeyEvent.VK_9;
        break;
    case 'A':
        mnemonic = KeyEvent.VK_A;
        break;
    case 'B':
        mnemonic = KeyEvent.VK_B;
        break;
    case 'C':
        mnemonic = KeyEvent.VK_C;
        break;
    case 'D':
        mnemonic = KeyEvent.VK_D;
        break;
    case 'E':
        mnemonic = KeyEvent.VK_E;
        break;
    case 'F':
        mnemonic = KeyEvent.VK_F;
        break;
    case 'G':
        mnemonic = KeyEvent.VK_G;
        break;
    case 'H':
        mnemonic = KeyEvent.VK_H;
        break;
    case 'I':
        mnemonic = KeyEvent.VK_I;
        break;
    case 'J':
        mnemonic = KeyEvent.VK_J;
        break;
    case 'K':
        mnemonic = KeyEvent.VK_K;
        break;
    case 'L':
        mnemonic = KeyEvent.VK_L;
        break;
    case 'M':
        mnemonic = KeyEvent.VK_M;
        break;
    case 'N':
        mnemonic = KeyEvent.VK_N;
        break;
    case 'O':
        mnemonic = KeyEvent.VK_O;
        break;
    case 'P':
        mnemonic = KeyEvent.VK_P;
        break;
    case 'Q':
        mnemonic = KeyEvent.VK_Q;
        break;
    case 'R':
        mnemonic = KeyEvent.VK_R;
        break;
    case 'S':
        mnemonic = KeyEvent.VK_S;
        break;
    case 'T':
        mnemonic = KeyEvent.VK_T;
        break;
    case 'U':
        mnemonic = KeyEvent.VK_U;
        break;
    case 'V':
        mnemonic = KeyEvent.VK_V;
        break;
    case 'W':
        mnemonic = KeyEvent.VK_W;
        break;
    case 'X':
        mnemonic = KeyEvent.VK_X;
        break;
    case 'Y':
        mnemonic = KeyEvent.VK_Y;
        break;
    case 'Z':
        mnemonic = KeyEvent.VK_Z;
        break;
    }
    return mnemonic;
}

From source file:org.gitools.ui.app.svg.ExportHeatmapSVGAction.java

public ExportHeatmapSVGAction() {
    super("Heatmap to SVG...");

    setDesc("Export the heatmap to SVG file");
    setMnemonic(KeyEvent.VK_H);
}

From source file:org.gitools.ui.app.actions.file.ExportHeatmapImageAction.java

public ExportHeatmapImageAction() {
    super("Heatmap to image...");

    setDesc("Export the heatmap to image file");
    setMnemonic(KeyEvent.VK_H);
}

From source file:org.gitools.ui.app.actions.file.ExportHierarchicalTreeImageAction.java

public ExportHierarchicalTreeImageAction() {
    super("Hierarchical tree to image...");

    setDesc("Export the hierarchical tree to image file");
    setMnemonic(KeyEvent.VK_H);
}

From source file:de.tor.tribes.ui.components.GroupSelectionList.java

public GroupSelectionList(String pResourceURL) {
    super(pResourceURL);

    setCellRenderer(renderer);//from  ww  w .  j  a  v a2 s . c om

    addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_LEFT) {
                fireDecrementEvent();
            } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
                fireIncrementEvent();
            } else if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                fireResetEvent();
            } else if (e.getKeyCode() == KeyEvent.VK_O) {
                fireSetStateEvent(ListItem.RELATION_TYPE.OR);
            } else if (e.getKeyCode() == KeyEvent.VK_U) {
                fireSetStateEvent(ListItem.RELATION_TYPE.AND);
            } else if (e.getKeyCode() == KeyEvent.VK_N) {
                fireSetStateEvent(ListItem.RELATION_TYPE.NOT);
            } else if (e.getKeyCode() == KeyEvent.VK_I) {
                fireSetStateEvent(ListItem.RELATION_TYPE.DISABLED);
            } else if (e.getKeyCode() == KeyEvent.VK_H) {
                JOptionPaneHelper.showInformationBox(GroupSelectionList.this, getRelationAsPlainText(),
                        "Information");
            }
        }
    });
    addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                if (e.getButton() == MouseEvent.BUTTON1) {
                    fireClickedEvent(e.getPoint());
                } else {
                    fireResetEvent(e.getPoint());
                }
            }
        }
    });
    TagManager.getSingleton().addManagerListener(GroupSelectionList.this);
}