Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.event.*; public class Main { private static boolean isNonEditKey(int keyCode) { switch (keyCode) { case KeyEvent.VK_UP: case KeyEvent.VK_DOWN: case KeyEvent.VK_LEFT: case KeyEvent.VK_RIGHT: case KeyEvent.VK_CAPS_LOCK: case KeyEvent.VK_CONTROL: case KeyEvent.VK_ALT: case KeyEvent.VK_SHIFT: case KeyEvent.VK_INSERT: case KeyEvent.VK_HOME: case KeyEvent.VK_END: case KeyEvent.VK_PAGE_DOWN: case KeyEvent.VK_PAGE_UP: case KeyEvent.VK_PRINTSCREEN: case KeyEvent.VK_NUM_LOCK: case KeyEvent.VK_ESCAPE: return true; } if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) { return true; } return false; } }