Here you can find the source of keyEventPressed(KeyEvent event, KeyStroke keyStroke)
public static boolean keyEventPressed(KeyEvent event, KeyStroke keyStroke)
//package com.java2s; //License from project: Apache License import javax.swing.*; import java.awt.event.KeyEvent; public class Main { public static boolean keyEventPressed(KeyEvent event, KeyStroke keyStroke) { int targetKeyCode = keyStroke.getKeyCode(); return event.getKeyCode() == targetKeyCode && (event.getModifiers() & KeyEvent.CTRL_MASK) != 0; }/* ww w.j a va 2 s.c o m*/ }