Skip to content

Distinguish between virtual input and human input #461

@ghost

Description

Key sources include real human keyboard input and java.awt.Robot virtual input. How do I distinguish them when using keyListener?

I tried to distinguish by these properties, but they are the same in both cases.

    public void nativeKeyPressed(NativeKeyEvent e) {

        System.out.println("--------------------------");
        System.out.println(e.getKeyCode());
        System.out.println(e.getKeyLocation());
        System.out.println(e.getWhen());
        System.out.println(e.getKeyChar());
        System.out.println(e.getSource());
        System.out.println(e.getID());
        System.out.println(e.getModifiers());
        System.out.println(e.getRawCode());
        System.out.println("==========================");
    }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions