Java tutorial
//package com.java2s; /* * Copyright (C) 2015 Miquel Sas * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. If not, see * <http://www.gnu.org/licenses/>. */ import java.awt.event.KeyEvent; public class Main { /** * Returns the mnemonic integer. * * @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; } }