0

i did

import java.awt.event.KeyEvent

but when i type

KeyEvent.get

the possible suggestions that the IDE give me are

KeyEvent.getKeyText:

and other methods for char, what i need to download or import ?

All i want is something that let me read arrow-keys. ty

Judal
  • 3
  • 2
  • If you are referring to `KeyEvent` (the class), you can only access static methods and fields. You need to refer to an instance of `KeyEvent`. – Andy Turner Mar 09 '16 at 22:04
  • 2
    `getKeyCode()` is not a static method. You cannot access it directly from the class. – Vince Mar 09 '16 at 22:06
  • 1
    `KeyEvent` is also associated with the AWT GUI framework. If you're doing GUI working (I hope you're using at least Swing), you might be better of with the [Key Bindings API](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) – MadProgrammer Mar 09 '16 at 22:08

1 Answers1

0

You may want to use KEY_PRESSED for static access.

Documentation for reference [here].1

mrLucius
  • 33
  • 1
  • 12
  • This does not determine which key was pressed. The OP couldn't use this as an alternative for `getKeyCode()` – Vince Mar 09 '16 at 22:43