Java using Xbox controller

Quillion picture Quillion · Jun 14, 2013 · Viewed 24.3k times · Source

What library would you recommend to hook up my Xbox 360 controller to Java, and be able to read key inputs into keyPressed Event as a KeyEvent.

So I would like something like this

private class KeyInputHandler extends KeyAdapter {
    public void keyPressed(KeyEvent e) {
    }
}

And I want all the controller presses to go into keyPressed.

I would appreciate it even further if you can provide good libraries for PS3 controllers too.

Answer

Corey Cole picture Corey Cole · Jun 14, 2013

The wired XBox 360 controller will present as a joystick in Windows, so a library like JXInput will allow you to accept inputs from it.

Simple example

JXInput site