Java Swing Key Action keyEventPressed(KeyEvent event, KeyStroke keyStroke)

Here you can find the source of keyEventPressed(KeyEvent event, KeyStroke keyStroke)

Description

key Event Pressed

License

Apache License

Declaration

public static boolean keyEventPressed(KeyEvent event, KeyStroke keyStroke) 

Method Source Code


//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*/
}

Related

  1. installCloseKey(final RootPaneContainer c)
  2. invoke(Action action, Object source)
  3. isActionSelected(Action action)
  4. isKeyStrokeEvent(@Nullable final KeyStroke keyStroke, final int keyEventType, @Nullable final KeyEvent event)
  5. isValidKey(int keyCode)
  6. keyStrokeToString(final KeyStroke keyStroke)
  7. keyStrokeToString(KeyStroke key)
  8. keyStrokeToString(KeyStroke key)
  9. keyStrokeToString(KeyStroke key)