1
\$\begingroup\$

The title basically says it all.

The only thing to take into consideration is it needs to be cross platform.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What about the java core libraries? \$\endgroup\$ Apr 25, 2012 at 12:46

2 Answers 2

3
\$\begingroup\$

While not technically a JAVA library SDL is a C library that I use extensively that does input and much more. It does however have bindings for java and can run on pretty much any platform in existence.

http://www.libsdl.org/languages.php

There is JSDL and SDLjava

\$\endgroup\$
1
\$\begingroup\$

Kind of depends.

Are you using JFrame without a game library or framework?

If so then you want to call the method addKeyListener(ListenerObjectHere) or addMouseListener(ListenerObjectHere) on the JFrame. Then the listeners you just created should Implement KeyListener or MouseListener.

If you're using a game framework it should have a polling system instead of events, which I'm not sure how to get around (Unless you could obtain the JFrame). If this is the case, just check each update (or tick) if a button is pressed.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .