Example usage for java.awt.event KeyEvent VK_LEFT

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

Introduction

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

Prototype

int VK_LEFT

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

Click Source Link

Document

Constant for the non-numpad left arrow key.

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);/*w w  w.  jav a2 s.  co m*/
            } 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;
}