Java tutorial
//package com.java2s; import java.awt.event.KeyEvent; public class Main { public static void checkKeyEventId(int id) { if (id != KeyEvent.KEY_TYPED && id != KeyEvent.KEY_PRESSED && id != KeyEvent.KEY_RELEASED) { throw new IllegalArgumentException("Invalid key event id"); } } }