Example usage for java.awt.event ActionEvent ACTION_LAST

List of usage examples for java.awt.event ActionEvent ACTION_LAST

Introduction

In this page you can find the example usage for java.awt.event ActionEvent ACTION_LAST.

Prototype

int ACTION_LAST

To view the source code for java.awt.event ActionEvent ACTION_LAST.

Click Source Link

Document

The last number in the range of ids used for action events.

Usage

From source file:Main.java

public KeyTextComponent() {
    setBackground(Color.CYAN);/*from  ww  w  .  j a v a 2s  .c o  m*/
    KeyListener internalKeyListener = new KeyAdapter() {
        public void keyPressed(KeyEvent keyEvent) {
            if (actionListenerList != null) {
                int keyCode = keyEvent.getKeyCode();
                String keyText = KeyEvent.getKeyText(keyCode);
                ActionEvent actionEvent = new ActionEvent(this, ActionEvent.ACTION_LAST, keyText);
                fireActionPerformed(actionEvent);
            }
        }
    };

    MouseListener internalMouseListener = new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            requestFocusInWindow();
        }
    };

    addKeyListener(internalKeyListener);
    addMouseListener(internalMouseListener);
}