Example usage for java.awt.event KeyEvent VK_0

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

Introduction

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

Prototype

int VK_0

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

Click Source Link

Document

Constant for the "0" key.

Usage

From source file:Main.java

public void keyPressed(KeyEvent evt) {
    int keyCode = evt.getKeyCode();

    if (keyCode == KeyEvent.VK_0) {
        System.out.println("KeyEvent.VK_0");
    }/*from  ww  w .  ja v  a  2 s .c  o  m*/
}

From source file:Main.java

/**
 * Returns the mnemonic integer./*from w  ww  .  j  a v  a2 s.  co  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:Main.java

public static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }/* w  w w .  ja  va2  s .  c  o m*/

    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";

    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";

    // numpad numeric keys handled below
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";

    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";

    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";

    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";

    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";

    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";

    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:Main.java

static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }//from  w  w w . j av a2 s  .  com
    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";
    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";
    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";
    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";
    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";
    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";
    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";
    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:Main.java

static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }/*from   w  ww  .j av a 2 s . c  o  m*/
    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";
    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";
    // numpad numeric keys handled below
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";
    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";
    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";
    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";
    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";
    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";
    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:de.tor.tribes.ui.windows.DSWorkbenchMainFrame.java

/**
 * Creates new form MapFrame/* ww w .j  a v a 2s .c om*/
 */
DSWorkbenchMainFrame() {
    initComponents();
    setAlwaysOnTop(false);
    if (!GlobalOptions.isMinimal()) {
        setTitle("DS Workbench " + Constants.VERSION + Constants.VERSION_ADDITION);
    } else {
        setTitle("DS Workbench Mini " + Constants.VERSION + Constants.VERSION_ADDITION);
    }

    jExportDialog.pack();
    jAddROIDialog.pack();

    JOutlookBar outlookBar = new JOutlookBar();
    outlookBar.addBar("Navigation", jNavigationPanel);
    outlookBar.addBar("Information", jInformationPanel);
    outlookBar.addBar("Karte", jMapPanel);
    outlookBar.addBar("ROI", jROIPanel);
    outlookBar.setVisibleBar(1);
    jSettingsScrollPane.setViewportView(outlookBar);

    mAbout = new AboutDialog(this, true);
    mAbout.pack();
    chooser.setDialogTitle("Speichern unter...");
    chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {

        @Override
        public boolean accept(File f) {
            return (f != null) && (f.isDirectory() || f.getName().endsWith(".png"));
        }

        @Override
        public String getDescription() {
            return "PNG Image (*.png)";
        }
    });

    chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {

        @Override
        public boolean accept(File f) {
            return (f != null) && (f.isDirectory() || f.getName().endsWith(".jpeg"));
        }

        @Override
        public String getDescription() {
            return "JPEG Image (*.jpeg)";
        }
    });

    //Schedule Backup
    new Timer("BackupTimer", true).schedule(new BackupTask(), 60 * 10000, 60 * 10000);

    //give focus to map panel if mouse enters map
    jMapPanelHolder.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseEntered(MouseEvent e) {
            jMapPanelHolder.requestFocusInWindow();
        }
    });

    getContentPane().setBackground(Constants.DS_BACK);
    pack();
    capabilityInfoPanel1.addActionListener(MapPanel.getSingleton());

    // <editor-fold defaultstate="collapsed" desc=" Add global KeyListener ">
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

        @Override
        public void eventDispatched(AWTEvent event) {
            if (event.getID() == KeyEvent.KEY_PRESSED) {
                KeyEvent e = (KeyEvent) event;
                if (DSWorkbenchMainFrame.getSingleton().isActive()) {
                    //move shortcuts
                    if (e.getKeyCode() == KeyEvent.VK_DOWN) {
                        scroll(0.0, 2.0);
                    } else if (e.getKeyCode() == KeyEvent.VK_UP) {
                        scroll(0.0, -2.0);
                    } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
                        scroll(-2.0, 0.0);
                    } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
                        scroll(2.0, 0.0);
                    } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //shot minimap tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_AXE);
                    } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack axe tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_RAM);
                    } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack ram tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SNOB);
                    } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack snob tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SPY);
                    } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack sword tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_LIGHT);
                    } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack light tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_HEAVY);
                    } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isShiftDown() && !e.isControlDown()
                            && !e.isAltDown()) {
                        //attack heavy tool shortcut
                        MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SWORD);
                    } else if ((e.getKeyCode() == KeyEvent.VK_S) && e.isControlDown() && !e.isAltDown()) {
                        //search frame shortcut
                        DSWorkbenchSearchFrame.getSingleton()
                                .setVisible(!DSWorkbenchSearchFrame.getSingleton().isVisible());
                    }
                }

                //misc shortcuts
                if ((e.getKeyCode() == KeyEvent.VK_0) && e.isAltDown()) {
                    //no tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_DEFAULT);
                } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //measure tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MEASURE);
                } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //mark tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MARK);
                } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //tag tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_TAG);
                } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //attack ingame tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SUPPORT);
                } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //attack ingame tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SELECTION);
                } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //attack ingame tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_RADAR);
                } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //attack ingame tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_INGAME);
                } else if ((e.getKeyCode() == KeyEvent.VK_8) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    //res ingame tool shortcut
                    MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SEND_RES_INGAME);
                } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isControlDown() && !e.isShiftDown()
                        && !e.isAltDown()) {
                    //move minimap tool shortcut
                    MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MOVE);
                } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isControlDown() && !e.isShiftDown()
                        && !e.isAltDown()) {
                    //zoom minimap tool shortcut
                    MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ZOOM);
                } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isControlDown() && !e.isShiftDown()
                        && !e.isAltDown()) {
                    //shot minimap tool shortcut
                    MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SHOT);
                } else if ((e.getKeyCode() == KeyEvent.VK_T) && e.isControlDown() && !e.isShiftDown()
                        && !e.isAltDown()) {
                    //search time shortcut
                    ClockFrame.getSingleton().setVisible(!ClockFrame.getSingleton().isVisible());
                } else if ((e.getKeyCode() == KeyEvent.VK_S) && e.isAltDown() && !e.isShiftDown()
                        && !e.isControlDown()) {
                    planMapshot();
                } else if (e.getKeyCode() == KeyEvent.VK_F2) {
                    DSWorkbenchAttackFrame.getSingleton()
                            .setVisible(!DSWorkbenchAttackFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F3) {
                    DSWorkbenchMarkerFrame.getSingleton()
                            .setVisible(!DSWorkbenchMarkerFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F4) {
                    DSWorkbenchTroopsFrame.getSingleton()
                            .setVisible(!DSWorkbenchTroopsFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F5) {
                    DSWorkbenchRankFrame.getSingleton()
                            .setVisible(!DSWorkbenchRankFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F6) {
                    DSWorkbenchFormFrame.getSingleton()
                            .setVisible(!DSWorkbenchFormFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F7) {
                    if (ServerSettings.getSingleton().isChurch()) {
                        DSWorkbenchChurchFrame.getSingleton()
                                .setVisible(!DSWorkbenchChurchFrame.getSingleton().isVisible());
                    }
                } else if (e.getKeyCode() == KeyEvent.VK_F8) {
                    DSWorkbenchConquersFrame.getSingleton()
                            .setVisible(!DSWorkbenchConquersFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F9) {
                    DSWorkbenchNotepad.getSingleton()
                            .setVisible(!DSWorkbenchNotepad.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F10) {
                    DSWorkbenchTagFrame.getSingleton()
                            .setVisible(!DSWorkbenchTagFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F11) {
                    DSWorkbenchStatsFrame.getSingleton()
                            .setVisible(!DSWorkbenchStatsFrame.getSingleton().isVisible());
                } else if (e.getKeyCode() == KeyEvent.VK_F12) {
                    DSWorkbenchSettingsDialog.getSingleton().setVisible(true);
                } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 1
                    centerROI(0);
                } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 2
                    centerROI(1);
                } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 3
                    centerROI(2);
                } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 4
                    centerROI(3);
                } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 5
                    centerROI(4);
                } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 6
                    centerROI(5);
                } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 7
                    centerROI(6);
                } else if ((e.getKeyCode() == KeyEvent.VK_8) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 8
                    centerROI(7);
                } else if ((e.getKeyCode() == KeyEvent.VK_9) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 9
                    centerROI(8);
                } else if ((e.getKeyCode() == KeyEvent.VK_0) && e.isControlDown() && e.isAltDown()
                        && !e.isShiftDown()) {
                    //ROI 10
                    centerROI(9);
                } else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                    jMapPanelHolder.requestFocusInWindow();
                    MapPanel.getSingleton().setSpaceDown(true);
                } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
                    jMapPanelHolder.requestFocusInWindow();
                    MapPanel.getSingleton().setShiftDown(true);
                }
            } else if (event.getID() == KeyEvent.KEY_RELEASED) {
                KeyEvent e = (KeyEvent) event;
                if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                    MapPanel.getSingleton().setSpaceDown(false);
                } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
                    MapPanel.getSingleton().setShiftDown(false);
                }
            }
        }
    }, AWTEvent.KEY_EVENT_MASK);
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc=" Load UI Icons ">
    try {
        jOnlineLabel.setIcon(new ImageIcon("./graphics/icons/online.png"));
        jEnableClipboardWatchButton.setIcon(new ImageIcon("./graphics/icons/watch_clipboard.png"));
        jCenterIngameButton
                .setIcon(new ImageIcon(DSWorkbenchMainFrame.class.getResource("/res/ui/center_ingame.png")));
        jRefreshButton.setIcon(new ImageIcon("./graphics/icons/refresh.png"));
        jCenterCoordinateIngame.setIcon(new ImageIcon("./graphics/icons/center.png"));
    } catch (Exception e) {
        logger.error("Failed to load status icon(s)", e);
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc=" Check for desktop support ">
    if (!Desktop.isDesktopSupported()) {
        jCenterIngameButton.setEnabled(false);
        jCenterCoordinateIngame.setEnabled(false);
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc=" Restore last map position ">
    try {
        String x = GlobalOptions.getSelectedProfile().getProperty("last.x");
        String y = GlobalOptions.getSelectedProfile().getProperty("last.y");
        centerPosition(Double.parseDouble(x), Double.parseDouble(y));
    } catch (Exception e) {
        centerPosition(ServerSettings.getSingleton().getMapDimension().getCenterX(),
                ServerSettings.getSingleton().getMapDimension().getCenterY());
    }

    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc=" Restore other settings ">
    jShowMapPopup.setSelected(GlobalOptions.getProperties().getBoolean("show.map.popup"));
    jShowMouseOverInfo.setSelected(GlobalOptions.getProperties().getBoolean("show.mouseover.info"));
    jIncludeSupport.setSelected(GlobalOptions.getProperties().getBoolean("include.support"));
    jHighlightTribeVillages.setSelected(GlobalOptions.getProperties().getBoolean("highlight.tribes.villages"));
    jShowRuler.setSelected(GlobalOptions.getProperties().getBoolean("show.ruler"));
    jDisplayChurch.setSelected(GlobalOptions.getProperties().getBoolean("show.church"));
    jDisplayWatchtower.setSelected(GlobalOptions.getProperties().getBoolean("show.watchtower"));
    jDisplayChurch.setEnabled(ServerSettings.getSingleton().isChurch());
    jDisplayWatchtower.setEnabled(ServerSettings.getSingleton().isWatchtower());
    ServerSettings.getSingleton().addListener(new ServerSettingsListener() {
        @Override
        public void fireServerSettingsChanged() {
            jDisplayChurch.setEnabled(ServerSettings.getSingleton().isChurch());
            jDisplayWatchtower.setEnabled(ServerSettings.getSingleton().isWatchtower());
        }
    });
    int r = GlobalOptions.getProperties().getInt("radar.size");
    int hour = r / 60;
    jHourField.setText(Integer.toString(hour));
    jMinuteField.setText(Integer.toString(r - hour * 60));
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Skin Setup">
    DefaultComboBoxModel gpModel = new DefaultComboBoxModel(GlobalOptions.getAvailableSkins());
    jGraphicPacks.setModel(gpModel);
    String skin = GlobalOptions.getProperty("default.skin");
    if (gpModel.getIndexOf(skin) != -1) {
        jGraphicPacks.setSelectedItem(skin);
    } else {
        jGraphicPacks.setSelectedItem("default");
    }
    //</editor-fold>

    minZoom = GlobalOptions.getProperties().getDouble("map.zoom.min");
    maxZoom = GlobalOptions.getProperties().getDouble("map.zoom.max");
    dZoomInOutFactor = GlobalOptions.getProperties().getDouble("map.zoom.in.out.factor");

    mNotificationHideThread = new NotificationHideThread();
    mNotificationHideThread.start();
    SystrayHelper.installSystrayIcon();
    //update online state
    onlineStateChanged();
    restoreProperties();
}

From source file:ffx.ui.MainMenu.java

/**
 * <p>//  ww  w  .j a  v a  2  s .  com
 * Constructor for MainMenu.</p>
 *
 * @param f a {@link ffx.ui.MainPanel} object.
 */
public MainMenu(MainPanel f) {

    // Create the Tool Bar
    toolBar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
    toolBar.setBorderPainted(true);
    toolBar.setRollover(true);
    JButton temp = new JButton();
    insets = temp.getInsets();
    insets.set(2, 2, 2, 2);

    mainPanel = f;
    graphics = mainPanel.getGraphics3D();
    locale = mainPanel.getFFXLocale();
    loader = getClass().getClassLoader();
    blankIcon = new ImageIcon(loader.getResource(icons + "blank.gif"));

    String value = System.getProperty("structures", "false").trim();
    try {
        includeStructureMenu = Boolean.parseBoolean(value);
    } catch (Exception e) {
        includeStructureMenu = false;
    }

    /**
     * Main Menubar
     */
    JMenu fileMenu = addMenu("File", 'F');
    JMenu selectionMenu = addMenu("Selection", 'E');
    JMenu structureMenu = null;
    if (includeStructureMenu) {
        structureMenu = addMenu("Structure", 'S');
    }
    JMenu displayMenu = addMenu("Display", 'D');
    JMenu colorMenu = addMenu("Color", 'C');
    JMenu optionsMenu = addMenu("Options", 'O');
    JMenu pickingMenu = addMenu("Picking", 'P');
    JMenu trajectoryMenu = addMenu("Trajectory", 'T');
    JMenu exportMenu = addMenu("Export", 'X');
    JMenu windowMenu = addMenu("Window", 'W');
    JMenu helpMenu = addMenu("Help", 'H');

    /**
     * File Menu - Events Handled by the MainPanel Class.
     */
    addMenuItem(fileMenu, icons + "folder_page", "Open", 'O', KeyEvent.VK_O, mainPanel);
    addMenuItem(fileMenu, icons + "disk", "SaveAs", 'S', KeyEvent.VK_S, mainPanel);
    addMenuItem(fileMenu, icons + "cancel", "Close", 'C', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "CloseAll", 'A', -1, mainPanel);
    fileMenu.addSeparator();
    addMenuItem(fileMenu, icons + "drive_web", "DownloadFromPDB", 'D', KeyEvent.VK_D, mainPanel);
    fileMenu.addSeparator();
    addMenuItem(fileMenu, "BLANK", "ChooseKeyFile", 'R', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "ChooseLogFile", 'I', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "LoadRestartData", 'R', -1, mainPanel);
    if (!SystemUtils.IS_OS_MAC_OSX) {
        fileMenu.addSeparator();
        addMenuItem(fileMenu, "BLANK", "Exit", 'E', KeyEvent.VK_Q, mainPanel);
    }
    toolBar.addSeparator();

    /**
     * Selection Menu - Events Handled by the MainPanel and GraphicsCanvas.
     */
    addMenuItem(selectionMenu, icons + "add", "SelectAll", 'A', KeyEvent.VK_A, mainPanel);
    addMenuItem(selectionMenu, "BLANK", "RestrictToSelections", 'R', -1, graphics);
    addMenuItem(selectionMenu, icons + "arrow_merge", "MergeSelections", 'M', -1, mainPanel);
    selectionMenu.addSeparator();
    highlightCBMI = addCBMenuItem(selectionMenu, icons + "asterisk_yellow", "HighlightSelections", 'H',
            KeyEvent.VK_H, mainPanel);
    addMenuItem(selectionMenu, "BLANK", "SetSelectionColor", 'S', -1, graphics);
    selectionMenu.addSeparator();
    labelAtomsMI = addCBMenuItem(selectionMenu, "BLANK", "LabelSelectedAtoms", 'O', -1, graphics);
    labelResiduesMI = addCBMenuItem(selectionMenu, "BLANK", "LabelSelectedResidues", 'R', -1, graphics);
    addMenuItem(selectionMenu, "BLANK", "SetLabelFontSize", 'Z', -1, graphics);
    addMenuItem(selectionMenu, "BLANK", "SetLabelFontColor", 'C', -1, graphics);
    highlightCBMI.setSelected(false);
    labelAtomsMI.setSelected(false);
    labelResiduesMI.setSelected(false);
    toolBar.addSeparator();

    /**
     * Structure Menu - Events Handled by the MainPanel.
     */
    if (includeStructureMenu) {
        // Locate a jar file that has PDB Structures.
        String file = "ffx/xray/structures/1N7S.pdb";
        addMenuItem(structureMenu, "BLANK", file, '.', -1, mainPanel);
    }

    /**
     * Display Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(displayMenu, "BLANK", "Wireframe", 'W', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Tube", 'T', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Spacefill", 'S', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "BallAndStick", 'B', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Invisible", 'I', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "RMIN", 'R', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "ShowHydrogens", 'H', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "HideHydrogens", 'Y', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "Fill", 'F', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Points", 'P', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Lines", 'I', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "Preferences", 'P', -1, graphics);

    /**
     * Color Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(colorMenu, "BLANK", "Monochrome", 'M', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "CPK", 'C', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Residue", 'R', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Structure", 'S', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Polymer", 'M', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "PartialCharge", 'P', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "UserColor", 'U', -1, graphics);
    colorMenu.addSeparator();
    addMenuItem(colorMenu, "BLANK", "ApplyUserColor", 'A', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "SetUserColor", 'C', -1, graphics);

    /**
     * Options Menu - Events handled by the GraphicsCanvas.
     */
    dragModeButtonGroup = new ButtonGroup();
    activeRBMI = addBGMI(dragModeButtonGroup, optionsMenu, "BLANK", "ActiveSystem", 'A', KeyEvent.VK_A,
            graphics);
    mouseRBMI = addBGMI(dragModeButtonGroup, optionsMenu, "BLANK", "SystemBelowMouse", 'S', KeyEvent.VK_M,
            graphics);
    activeRBMI.setSelected(true);
    optionsMenu.addSeparator();
    JMenu leftMouseMenu = addSubMenu(optionsMenu, "LeftMouseButton", 'M');
    leftMouseButtonGroup = new ButtonGroup();
    rotateRBMI = addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Rotate", 'R', KeyEvent.VK_R, graphics);
    addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Translate", 'T', KeyEvent.VK_T, graphics);
    addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Zoom", 'Z', KeyEvent.VK_Z, graphics);
    rotateRBMI.setSelected(true);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, "BLANK", "RotateAboutCenter", 'C', KeyEvent.VK_C, graphics);
    addMenuItem(optionsMenu, "BLANK", "RotateAboutPick", 'P', KeyEvent.VK_P, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetRotation", 'R', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetTranslation", 'T', -1, graphics);
    addMenuItem(optionsMenu, icons + "arrow_refresh", "ResetRotationAndTranslation", 'E', -1, graphics);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, icons + "magnifier_zoom_in", "ZoomIn", 'I', -1, graphics);
    addMenuItem(optionsMenu, icons + "magnifier_zoom_out", "ZoomOut", 'O', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalZoom", 'Z', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalRotation", 'N', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalTranslation", 'O', -1, graphics);
    addMenuItem(optionsMenu, icons + "house", "ResetGlobalView", 'V', -1, graphics);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, "BLANK", "SetBackgroundColor", 'B', -1, graphics);
    toolBar.addSeparator();

    /**
     * Picking Menu - Events handled by the GraphicsCanvas.
     */
    levelBG = new ButtonGroup();
    pickingCBMI = addCBMenuItem(pickingMenu, icons + "wand", "GraphicsPicking", 'G', KeyEvent.VK_0, graphics);
    pickingCBMI.setSelected(false);
    pickingMenu.addSeparator();
    atomRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickAtom", 'A', KeyEvent.VK_1, graphics);
    bondRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickBond", 'B', KeyEvent.VK_2, graphics);
    angleRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickAngle", 'N', KeyEvent.VK_3, graphics);
    dihedralRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickDihedral", 'D', KeyEvent.VK_4, graphics);
    residueRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickResidue", 'R', KeyEvent.VK_5, graphics);
    polymerRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickPolymer", 'P', KeyEvent.VK_6, graphics);
    moleculeRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickMolecule", 'M', KeyEvent.VK_7, graphics);
    systemRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickSystem", 'S', KeyEvent.VK_8, graphics);
    pickingMenu.addSeparator();
    measureDistanceRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureDistance", 'I', -1, graphics);
    measureAngleRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureAngle", 'L', -1, graphics);
    measureDihedralRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureDihedral", 'H', -1, graphics);
    atomRBMI.setSelected(true);
    pickingMenu.addSeparator();
    addMenuItem(pickingMenu, "BLANK", "SetGraphicsPickingColor", 'S', -1, graphics);
    toolBar.addSeparator();

    /**
     * Trajectory Menu - Events handled by the MainPanel.
     */
    oscillateCBMI = addCBMenuItem(trajectoryMenu, icons + "control_repeat_blue", "Oscillate", 'O', -1,
            mainPanel);
    oscillateCBMI.setSelected(false);
    addMenuItem(trajectoryMenu, "BLANK", "Frame", 'A', -1, mainPanel);
    addMenuItem(trajectoryMenu, "BLANK", "Speed", 'E', -1, mainPanel);
    addMenuItem(trajectoryMenu, "BLANK", "Skip", 'K', -1, mainPanel);
    trajectoryMenu.addSeparator();
    addMenuItem(trajectoryMenu, icons + "control_play_blue", "Play", 'P', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_stop_blue", "Stop", 'S', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_fastforward_blue", "StepForward", 'F', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_rewind_blue", "StepBack", 'B', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_start_blue", "Reset", 'R', -1, mainPanel);
    toolBar.addSeparator();

    /**
     * Export Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(exportMenu, icons + "camera", "CaptureGraphics", 'C', KeyEvent.VK_G, graphics);
    exportMenu.addSeparator();
    captureFormatButtonGroup = new ButtonGroup();
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "PNG", 'P', -1, graphics).setSelected(true);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "JPEG", 'J', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "BMP", 'B', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "WBMP", 'W', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "GIF", 'G', -1, graphics);
    toolBar.addSeparator();

    /**
     * Window Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(windowMenu, icons + "application_home", "ResetPanes", 'R', -1, mainPanel);
    addMenuItem(windowMenu, icons + "application_osx_terminal", "ResetConsole", 'L', -1, mainPanel);
    windowMenu.addSeparator();
    addMenuItem(windowMenu, icons + "application_side_contract", "ExpandGraphicsWindow", 'E', -1, mainPanel);
    addMenuItem(windowMenu, icons + "application_side_expand", "ShrinkGraphicsWindow", 'L', -1, mainPanel);
    windowMenu.addSeparator();
    systemsCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowTree", 'T', -1, mainPanel);
    toolBarCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowToolBar", 'B', -1, mainPanel);
    globalAxisCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowGlobalAxes", 'C', -1, mainPanel);
    globalAxisCBMI.setSelected(true);
    toolBar.addSeparator();

    /**
     * Help Menu - Events handled by the MainPanel.
     */
    Action a = addMenuItem(helpMenu, icons + "help", "HelpContents", 'H', KeyEvent.VK_HELP, mainPanel);
    /**
     * Fix the ACCELERATOR_KEY for the Help menu item; no modifiers will be
     * used.
     */
    a.putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0));

    addMenuItem(helpMenu, "BLANK", "About", 'A', -1, mainPanel);

}

From source file:ca.phon.app.session.editor.view.segmentation.SegmentationEditorView.java

@Override
public JMenu getMenu() {
    final JMenu retVal = new JMenu();

    final KeyStroke noPartKs = KeyStroke.getKeyStroke(KeyEvent.VK_0,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    final NewSegmentAction noSpeakerAct = new NewSegmentAction(getEditor(), this, null);
    noSpeakerAct.putValue(NewSegmentAction.NAME, "New record with unspecified speaker");
    noSpeakerAct.putValue(NewSegmentAction.ACCELERATOR_KEY, noPartKs);

    retVal.add(noSpeakerAct);/* w  w w  .  java2  s  . c  om*/

    final Session session = getEditor().getSession();
    int pIdx = 1;
    for (Participant p : session.getParticipants()) {
        final KeyStroke partKs = KeyStroke.getKeyStroke(KeyEvent.VK_0 + (pIdx++),
                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
        final NewSegmentAction speakerAct = new NewSegmentAction(getEditor(), this, p);
        speakerAct.putValue(NewSegmentAction.NAME, "New record for " + p.toString());
        speakerAct.putValue(NewSegmentAction.ACCELERATOR_KEY, partKs);

        retVal.add(speakerAct);
    }

    return retVal;
}

From source file:com.std.StockPanel.java

public void setHistoricalData() {
    this.setLayout(new BorderLayout());
    nameAndChangePanel.setLayout(new BoxLayout(nameAndChangePanel, BoxLayout.PAGE_AXIS));
    nameAndChangePanel.add(nameLbl);/*  w w w.  j  a  v  a 2s.  com*/
    nameAndChangePanel.add(priceChangePercentLbl);

    data = new Object[30][2];
    String[] colnames = { "1", "2" };

    GridBagConstraints c = new GridBagConstraints();
    dataAndGraph.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 0;
    c.gridheight = 1;
    c.insets = new Insets(0, 20, 0, 20);
    dataAndGraph.add(nameAndChangePanel, c);
    c.weightx = 0;
    c.weighty = 1;
    c.insets = new Insets(0, 20, 0, 0);
    //c.ipady = 20;
    c.gridx = 0;
    c.gridy = 1;
    remainingInfoTable = new StockTable(data, colnames);
    remainingInfoTable.setShowGrid(false);
    remainingInfoTable.setTableHeader(null);
    remainingInfoTable.setBackground(this.getBackground());
    remainingInfoTable.setFocusable(false);
    remainingInfoTable.setColumnSelectionAllowed(false);
    remainingInfoTable.setRowSelectionAllowed(false);
    remainingInfoTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    dataAndGraph.add(remainingInfoTable, c);
    this.add(dataAndGraph, BorderLayout.CENTER);

    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 0;
    c.gridheight = 2;
    //c.ipady = 20;
    c.gridx = 1;
    c.gridy = 0;
    dataAndGraph.add(chartPane, c);
    chartPane.setVisible(false);
    this.add(dataAndGraph, BorderLayout.CENTER);

    Test.show_hist_data(currentStock, b);
    currentStock.calculate_beta(sp500, 1200);

    nameLbl.setText(currentStock.get_name() + " (" + currentStock.get_symbol() + ")");
    nameLbl.setFont(new Font(nameLbl.getName(), Font.BOLD, 24));
    priceChangePercentLbl.setText(currentStock.get_price() + " ");
    String message = currentStock.get_change() + " " + currentStock.get_percent_change();
    if (Double.parseDouble(currentStock.get_change()) < 0)
        priceChangePercentLbl.setText(String.format("<html>%s<font color='red'>%s</font></html>",
                priceChangePercentLbl.getText(), message));
    else
        priceChangePercentLbl.setText(String.format("<html>%s<font color='green'>%s</font></html>",
                priceChangePercentLbl.getText(), message));
    priceChangePercentLbl.setFont(new Font(priceChangePercentLbl.getName(), Font.PLAIN, 15));

    data[0][0] = "Prev Close: " + currentStock.get_prev_close();
    data[1][0] = "Open: " + currentStock.get_open_price();
    data[2][0] = "Bid: " + currentStock.get_bid();
    data[3][0] = "Ask: " + currentStock.get_ask();
    data[4][0] = "One Year Target: " + currentStock.get_one_year_target();
    data[5][0] = "Ebita: " + currentStock.get_ebitda();
    data[0][1] = "Day Range: " + currentStock.get_days_range();
    data[1][1] = "52 Week Range: " + currentStock.get_year_range();
    data[2][1] = "Volume: " + currentStock.get_volume();
    data[3][1] = "Average Daily Volume: " + currentStock.get_avg_daily_volume();
    data[4][1] = "Market Cap: " + currentStock.get_market_cap();
    data[5][1] = "P/E: " + currentStock.get_pe();
    data[6][1] = "EPS: " + currentStock.get_earnings_per_share();
    data[7][1] = "Dividend (Yield): " + currentStock.get_dividend_per_share() + "("
            + currentStock.get_dividend_yield() + ")";
    data[6][0] = "Reveune:" + currentStock.get_revenue();
    data[7][0] = "Earnings Estimate: " + currentStock.get_earnings_estimate_current_year();
    data[8][0] = "Beta: " + currentStock.get_beta();
    data[8][1] = "PEG Ratio: " + currentStock.get_peg_ratio();
    data[9][0] = "Short Ratio: " + currentStock.get_short_ratio();

    data[11][0] = "50 Day MA: " + currentStock.get_fiftyday_moving_avg();
    data[12][0] = "200 Day MA: " + currentStock.get_twohundredday_moving_avg();
    if (currentStock.get_change_from_fiftyday_moving_avg() != null
            && currentStock.get_change_from_fiftyday_moving_avg().contains("-")) {
        data[13][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 50 Day MA: ",
                currentStock.get_change_from_fiftyday_moving_avg());
        data[14][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 50 Day MA: ",
                currentStock.get_percent_change_from_fiftyday_moving_avg());

    } else {
        data[13][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 50 Day MA: ",
                currentStock.get_change_from_fiftyday_moving_avg());
        data[14][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 50 Day MA: ",
                currentStock.get_percent_change_from_fiftyday_moving_avg());
    }
    if (currentStock.get_change_from_twohundredday_moving_avg() != null
            && currentStock.get_change_from_twohundredday_moving_avg().contains("-")) {
        data[15][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 200 Day MA: ",
                currentStock.get_change_from_twohundredday_moving_avg());
        data[16][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 200 Day MA: ",
                currentStock.get_percent_change_from_twohundredday_moving_avg());
    } else {
        data[15][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 200 Day MA: ",
                currentStock.get_change_from_twohundredday_moving_avg());
        data[16][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 200 Day MA: ",
                currentStock.get_percent_change_from_twohundredday_moving_avg());
    }
    data[17][0] = "Year High: " + currentStock.get_year_high();
    data[18][0] = "Year Low: " + currentStock.get_year_low();
    if (currentStock.get_change_from_year_high() != null
            && currentStock.get_change_from_year_high().contains("-")) {
        data[19][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Change: ",
                currentStock.get_change_from_year_high());
        data[20][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Percent: ",
                currentStock.get_percent_change_from_year_high());
    } else {
        data[19][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Change: ",
                currentStock.get_change_from_year_high());
        data[20][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Percent: ",
                currentStock.get_percent_change_from_year_high());
    }
    if (currentStock.get_change_from_year_low() != null
            && currentStock.get_change_from_year_low().contains("-")) {
        data[21][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Change: ",
                currentStock.get_change_from_year_low());
        data[22][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Percent:  ",
                currentStock.get_percent_change_from_year_low());
    } else {
        data[21][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Change: ",
                currentStock.get_change_from_year_low());
        data[22][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Percent:  ",
                currentStock.get_percent_change_from_year_low());
    }
    if (currentStock.get_five_day_change()[0] != null && currentStock.get_five_day_change()[0].contains("-"))
        data[11][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5D Change: ",
                currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")");
    else
        data[11][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5D Change: ",
                currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")");
    if (currentStock.get_one_month_change()[0] != null && currentStock.get_one_month_change()[0].contains("-"))
        data[12][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1M Change: ",
                currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")");
    else
        data[12][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1M Change: ",
                currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")");
    if (currentStock.get_three_month_change()[0] != null
            && currentStock.get_three_month_change()[0].contains("-"))
        data[13][1] = String.format("<html>%s<font color='red'>%s</font></html>", "3M Change: ",
                currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1]
                        + ")");
    else
        data[13][1] = String.format("<html>%s<font color='green'>%s</font></html>", "3M Change: ",
                currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1]
                        + ")");
    if (currentStock.get_six_month_change()[0] != null && currentStock.get_six_month_change()[0].contains("-"))
        data[14][1] = String.format("<html>%s<font color='red'>%s</font></html>", "6M Change: ",
                currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")");
    else
        data[14][1] = String.format("<html>%s<font color='green'>%s</font></html>", "6M Change: ",
                currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")");
    if (currentStock.get_ytd_change()[0] != null && currentStock.get_ytd_change()[0].contains("-"))
        data[15][1] = String.format("<html>%s<font color='red'>%s</font></html>", "YTD Change: ",
                currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")");
    else
        data[15][1] = String.format("<html>%s<font color='green'>%s</font></html>", "YTD Change: ",
                currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")");
    if (currentStock.get_one_year_change()[0] != null && currentStock.get_one_year_change()[0].contains("-"))
        data[16][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1Y Change: ",
                currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")");
    else
        data[16][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1Y Change: ",
                currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")");
    if (currentStock.get_five_year_change()[0] != null && currentStock.get_five_year_change()[0].contains("-"))
        data[17][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5Y Change: ",
                currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")");
    else
        data[17][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5Y Change: ",
                currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")");
    if (currentStock.get_ten_year_change()[0] != null && currentStock.get_ten_year_change()[0].contains("-"))
        data[18][1] = String.format("<html>%s<font color='red'>%s</font></html>", "10Y Change: ",
                currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")");
    else
        data[18][1] = String.format("<html>%s<font color='green'>%s</font></html>", "10Y Change: ",
                currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")");
    if (currentStock.get_max_year_change()[0] != null && currentStock.get_max_year_change()[0].contains("-"))
        data[19][1] = String.format("<html>%s<font color='red'>%s</font></html>", "Max Change: ",
                currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")");
    else
        data[19][1] = String.format("<html>%s<font color='green'>%s</font></html>", "Max Change: ",
                currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")");

    data[24][0] = "Earnings Est Next Quarter: " + currentStock.get_earnings_estimate_next_quarter();
    data[25][0] = "Earnings Est Current Year: " + currentStock.get_earnings_estimate_current_year();
    data[26][0] = "Earnings Est Next Year: " + currentStock.get_earnings_estimate_next_year();
    data[24][1] = "P/E Est Current Year: " + currentStock.get_price_eps_estimate_current_year();
    data[25][1] = "P/E Est Next Year: " + currentStock.get_price_eps_estimate_next_year();
    remainingInfoTable.setFont(new Font(remainingInfoTable.getName(), Font.PLAIN, 15));
    remainingInfoTable.packColumn(0, 4);
    remainingInfoTable.packColumn(1, 4);

    try {
        dataAndGraph.remove(chartPane);
        chartPane = new JTabbedPane();
        chartPane.setVisible(true);
        ChartPanel intradayChart = new IntradayChart(currentStock).getChartPanel();
        intradayChart.setPopupMenu(graphMenu);
        chartPane.addTab("1d", intradayChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_1);

        ChartPanel fivedayChart = new FiveDayChart(currentStock).getChartPanel();
        fivedayChart.setPopupMenu(graphMenu);
        chartPane.addTab("5d", fivedayChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_2);

        ChartPanel onemonthChart = new OneMonthChart(currentStock).getChartPanel();
        onemonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("1m", onemonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_3);

        ChartPanel threemonthChart = new ThreeMonthChart(currentStock).getChartPanel();
        threemonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("3m", threemonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_4);

        ChartPanel sixmonthChart = new SixMonthChart(currentStock).getChartPanel();
        sixmonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("6m", sixmonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_5);

        ChartPanel ytdChart = new YTDChart(currentStock).getChartPanel();
        ytdChart.setPopupMenu(graphMenu);
        chartPane.addTab("ytd", ytdChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_6);

        ChartPanel oneyearChart = new OneYearChart(currentStock).getChartPanel();
        oneyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("1y", oneyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_7);

        ChartPanel fiveyearChart = new FiveYearChart(currentStock).getChartPanel();
        fiveyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("5y", fiveyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_8);

        ChartPanel tenyearChart = new TenYearChart(currentStock).getChartPanel();
        tenyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("10y", tenyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_9);

        ChartPanel maxChart = new MaxChart(currentStock).getChartPanel();
        maxChart.setPopupMenu(graphMenu);
        chartPane.addTab("max", maxChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_0);

        c = new GridBagConstraints();
        c.anchor = GridBagConstraints.NORTHWEST;
        c.fill = GridBagConstraints.BOTH;
        c.weightx = 1;
        c.weighty = 0;
        c.gridheight = 2;
        //c.ipady = 20;
        c.gridx = 1;
        c.gridy = 0;
        dataAndGraph.add(chartPane, c);

    } catch (ParseException ex) {
        Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
    }
    chartPane.revalidate();
    chartPane.repaint();
    revalidate();
    repaint();
    finished = true;
}

From source file:edu.purdue.cc.bionet.ui.CorrelationDisplayPanel.java

/**
 * Adds all of the necessary Components to this Component.
 *//*from  w  w w  .  ja va 2  s . c  o  m*/
private void buildPanel() {

    Language language = Settings.getLanguage();
    this.correlationMethodMenu = new JMenu(language.get("Correlation Method"));
    this.correlationMethodMenuButtonGroup = new ButtonGroup();
    this.pearsonCalculationMenuItem = new JRadioButtonMenuItem(language.get("Pearson"), true);
    this.spearmanCalculationMenuItem = new JRadioButtonMenuItem(language.get("Spearman"));
    this.kendallCalculationMenuItem = new JRadioButtonMenuItem(language.get("Kendall"));

    // layout menu itmes
    this.layoutMenu = new JMenu(language.get("Layout"));
    this.layoutMenuButtonGroup = new ButtonGroup();
    this.multipleCirclesLayoutMenuItem = new JRadioButtonMenuItem(language.get("Multiple Circles"));
    this.singleCircleLayoutMenuItem = new JRadioButtonMenuItem(language.get("Single Circle"), true);
    this.randomLayoutMenuItem = new JRadioButtonMenuItem(language.get("Random"));
    this.heatMapLayoutMenuItem = new JRadioButtonMenuItem(language.get("Heat Map"));
    this.kkLayoutMenuItem = new JRadioButtonMenuItem(language.get("Kamada-Kawai"));
    //      this.frLayoutMenuItem = 
    //            new JRadioButtonMenuItem( language.get( "Fruchterman-Reingold" ));
    //      this.springLayoutMenuItem = 
    //               new JRadioButtonMenuItem( language.get( "Spring Layout" ));
    this.frSpringLayoutMenuItem = new JRadioButtonMenuItem(language.get("Spring Layout"));
    //      this.animatedLayoutMenuItem = new JCheckBoxMenuItem( 
    //         language.get( "Fruchterman-Reingold Spring Embedding" ));

    // view menu items
    this.viewMenu = new JMenu(language.get("View"));
    this.zoomInViewMenuItem = new JMenuItem(language.get("Zoom In"), KeyEvent.VK_I);
    this.zoomOutViewMenuItem = new JMenuItem(language.get("Zoom Out"), KeyEvent.VK_O);
    this.fitToWindowViewMenuItem = new JMenuItem(language.get("Fit to Window"), KeyEvent.VK_F);
    this.selectAllViewMenuItem = new JMenuItem(language.get("Select All"), KeyEvent.VK_A);
    this.clearSelectionViewMenuItem = new JMenuItem(language.get("Clear Selection"), KeyEvent.VK_C);
    this.invertSelectionViewMenuItem = new JMenuItem(language.get("Invert Selection"), KeyEvent.VK_I);
    this.selectCorrelatedViewMenuItem = new JMenuItem(language.get("Select Correlated to Selection"),
            KeyEvent.VK_R);
    this.hideSelectedViewMenuItem = new JMenuItem(language.get("Hide Selected"), KeyEvent.VK_H);
    this.hideUnselectedViewMenuItem = new JMenuItem(language.get("Hide Unselected"), KeyEvent.VK_U);
    this.hideUncorrelatedViewMenuItem = new JMenuItem(language.get("Hide Uncorrelated to Selection"),
            KeyEvent.VK_L);
    this.hideOrphansViewMenuItem = new JMenuItem(language.get("Hide Orphans"), KeyEvent.VK_P);
    this.showCorrelatedViewMenuItem = new JMenuItem(language.get("Show All Correlated to Visible"),
            KeyEvent.VK_S);
    this.saveImageAction = new SaveImageAction(language.get("Save Main Graph Image") + "...", null);

    // groups menu items
    this.groupsMenu = new JMenu(language.get("Groups"));
    this.resetSampleGroupsMenuItem = new JMenuItem(language.get("Reset Sample Groups"), KeyEvent.VK_R);
    this.chooseSampleGroupsMenuItem = new JMenuItem(language.get("Choose Sample Groups") + "...",
            KeyEvent.VK_C);

    // color menu items
    this.colorMenu = new JMenu(language.get("Color"));
    this.colorMenuButtonGroup = new ButtonGroup();
    this.normalColorMenuItem = new JRadioButtonMenuItem(language.get("Normal Color"), true);
    this.highContrastColorMenuItem = new JRadioButtonMenuItem(language.get("High Contrast Color"));

    // CORRELATION FILTER ELEMENTS
    JPanel leftPanel = new JPanel(new BorderLayout());
    this.moleculeFilterPanel = new MoleculeFilterPanel();
    leftPanel.add(moleculeFilterPanel, BorderLayout.CENTER);
    this.correlationFilterPanel = new CorrelationFilterPanel();
    leftPanel.add(this.correlationFilterPanel, BorderLayout.SOUTH);

    //CALCULATION MENU
    this.correlationMethodMenu.setMnemonic(KeyEvent.VK_C);
    this.correlationMethodMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Perform Data Calculations"));
    this.correlationMethodMenuButtonGroup.add(this.pearsonCalculationMenuItem);
    this.correlationMethodMenuButtonGroup.add(this.spearmanCalculationMenuItem);
    this.correlationMethodMenuButtonGroup.add(this.kendallCalculationMenuItem);
    this.pearsonCalculationMenuItem.setMnemonic(KeyEvent.VK_P);
    this.spearmanCalculationMenuItem.setMnemonic(KeyEvent.VK_S);
    this.kendallCalculationMenuItem.setMnemonic(KeyEvent.VK_K);
    this.correlationMethodMenu.add(this.pearsonCalculationMenuItem);
    this.correlationMethodMenu.add(this.spearmanCalculationMenuItem);
    this.correlationMethodMenu.add(this.kendallCalculationMenuItem);
    this.pearsonCalculationMenuItem.addItemListener(this);
    this.spearmanCalculationMenuItem.addItemListener(this);
    this.kendallCalculationMenuItem.addItemListener(this);

    //LAYOUT MENU
    LayoutChangeListener lcl = new LayoutChangeListener();
    this.layoutMenu.setMnemonic(KeyEvent.VK_L);
    this.layoutMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the layout of the graph"));
    this.layoutMenuButtonGroup.add(this.multipleCirclesLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.singleCircleLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.randomLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.kkLayoutMenuItem);
    //      this.layoutMenuButtonGroup.add( this.frLayoutMenuItem );
    //      this.layoutMenuButtonGroup.add( this.springLayoutMenuItem );
    this.layoutMenuButtonGroup.add(this.frSpringLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.heatMapLayoutMenuItem);

    Enumeration<AbstractButton> e = this.layoutMenuButtonGroup.getElements();
    this.layoutMenu.add(this.multipleCirclesLayoutMenuItem);
    this.layoutMenu.add(this.singleCircleLayoutMenuItem);
    this.layoutMenu.add(this.randomLayoutMenuItem);
    this.layoutMenu.add(this.kkLayoutMenuItem);
    //      this.layoutMenu.add( this.frLayoutMenuItem );
    //      this.layoutMenu.add( this.springLayoutMenuItem );
    this.layoutMenu.add(this.frSpringLayoutMenuItem);
    this.layoutMenu.add(this.heatMapLayoutMenuItem);
    //      this.layoutMenu.addSeparator( );
    //      this.layoutMenu.add( this.animatedLayoutMenuItem );
    this.multipleCirclesLayoutMenuItem.addActionListener(lcl);
    this.multipleCirclesLayoutMenuItem.setEnabled(false);
    this.singleCircleLayoutMenuItem.addActionListener(lcl);
    this.randomLayoutMenuItem.addActionListener(lcl);
    this.kkLayoutMenuItem.addActionListener(lcl);
    //      this.frLayoutMenuItem.addActionListener( lcl );
    this.frSpringLayoutMenuItem.addActionListener(lcl);
    this.heatMapLayoutMenuItem.addActionListener(lcl);
    //      this.animatedLayoutMenuItem.addActionListener( lcl );

    //VIEW MENU
    this.viewMenu.add(this.colorMenu);
    this.viewMenu.addSeparator();
    this.viewMenu.setMnemonic(KeyEvent.VK_V);
    this.viewMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the data view settings"));
    this.viewMenu.add(this.zoomOutViewMenuItem);
    this.viewMenu.add(this.zoomInViewMenuItem);
    this.viewMenu.add(this.fitToWindowViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.selectAllViewMenuItem);
    this.viewMenu.add(this.clearSelectionViewMenuItem);
    this.viewMenu.add(this.invertSelectionViewMenuItem);
    this.viewMenu.add(this.selectCorrelatedViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.hideSelectedViewMenuItem);
    this.viewMenu.add(this.hideUnselectedViewMenuItem);
    this.viewMenu.add(this.hideUncorrelatedViewMenuItem);
    this.viewMenu.add(this.hideOrphansViewMenuItem);
    this.viewMenu.add(this.showCorrelatedViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.saveImageAction);
    this.resetSampleGroupsMenuItem.addActionListener(this);
    this.chooseSampleGroupsMenuItem.addActionListener(this);
    this.zoomOutViewMenuItem.addActionListener(this);
    this.zoomInViewMenuItem.addActionListener(this);
    this.fitToWindowViewMenuItem.addActionListener(this);
    this.selectAllViewMenuItem.addActionListener(this);
    this.clearSelectionViewMenuItem.addActionListener(this);
    this.invertSelectionViewMenuItem.addActionListener(this);
    this.selectCorrelatedViewMenuItem.addActionListener(this);
    this.hideSelectedViewMenuItem.addActionListener(this);
    this.hideUnselectedViewMenuItem.addActionListener(this);
    this.hideUncorrelatedViewMenuItem.addActionListener(this);
    this.hideOrphansViewMenuItem.addActionListener(this);
    this.showCorrelatedViewMenuItem.addActionListener(this);
    this.selectAllViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK));
    this.clearSelectionViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));

    // GROUPS MENU
    this.groupsMenu.setMnemonic(KeyEvent.VK_G);
    this.groupsMenu.add(this.resetSampleGroupsMenuItem);
    this.groupsMenu.add(this.chooseSampleGroupsMenuItem);

    this.zoomOutViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK));
    this.zoomInViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_DOWN_MASK));
    this.fitToWindowViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK));
    this.hideSelectedViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));

    //COLOR MENU
    this.colorMenu.setMnemonic(KeyEvent.VK_R);
    this.colorMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the color of the graph"));
    this.colorMenuButtonGroup.add(this.normalColorMenuItem);
    this.colorMenuButtonGroup.add(this.highContrastColorMenuItem);
    this.colorMenu.add(this.normalColorMenuItem);
    this.colorMenu.add(this.highContrastColorMenuItem);
    this.normalColorMenuItem.addItemListener(this);
    this.highContrastColorMenuItem.addItemListener(this);

    this.menuBar.add(this.correlationMethodMenu);
    this.menuBar.add(this.layoutMenu);
    this.menuBar.add(this.viewMenu);
    this.menuBar.add(this.groupsMenu);

    // Add the panels to the main panel
    this.add(menuBar, BorderLayout.NORTH);
    //      this.add( this.correlationViewPanel, BorderLayout.CENTER );
    this.add(leftPanel, BorderLayout.WEST);
}