Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;

public class Main {
    public static void main(String[] argv) throws Exception {

        KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
            public boolean dispatchKeyEvent(KeyEvent e) {
                if (e.getID() == KeyEvent.KEY_TYPED) {
                    e.setKeyChar('a');
                }
                boolean discardEvent = false;
                return discardEvent;
            }
        });
    }
}