Example usage for java.awt.event KeyEvent KEY_RELEASED

List of usage examples for java.awt.event KeyEvent KEY_RELEASED

Introduction

In this page you can find the example usage for java.awt.event KeyEvent KEY_RELEASED.

Prototype

int KEY_RELEASED

To view the source code for java.awt.event KeyEvent KEY_RELEASED.

Click Source Link

Document

The "key released" event.

Usage

From source file:view.MainWindow.java

@Override
public boolean dispatchKeyEvent(KeyEvent e) {
    if (e.getID() == KeyEvent.KEY_PRESSED) {
        if (e.isControlDown()) {
            if (e.getKeyCode() == KeyEvent.VK_W) {
                closeDocument(true);/*from w  w  w .j a v  a  2 s .c  om*/
            } else if (e.getKeyCode() == KeyEvent.VK_ADD) {
                workspacePanel.zoomIn();
            } else if (e.getKeyCode() == KeyEvent.VK_SUBTRACT) {
                workspacePanel.zoomOut();
            } else if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_RIGHT) {
                workspacePanel.pageUp();
            } else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_LEFT) {
                workspacePanel.pageDown();
            }
            if (e.isShiftDown()) {
                if (e.getKeyCode() == KeyEvent.VK_S) {
                    workspacePanel.changeCard(WorkspacePanel.CardEnum.SIGN_PANEL, true);
                } else if (e.getKeyCode() == KeyEvent.VK_V) {
                    workspacePanel.changeCard(WorkspacePanel.CardEnum.VALIDATE_PANEL, true);
                }
            }
        }
    } else if (e.getID() == KeyEvent.KEY_RELEASED) {
    } else if (e.getID() == KeyEvent.KEY_TYPED) {
    }
    return false;
}