java - Simple Key Listener does not work NetBeans -


i using netbeans build application.

all mouse listeners works great, key listener not listening @ all.

private void viewport1keypressed(java.awt.event.keyevent evt) {                                          system.out.println(evt.vk_space);         if (evt.getkeycode() == evt.vk_space) {             system.out.println("bingo");  } 

no output there, , use evt.vk_space netbeans alerts me accessing static field.

what doing wrong?

it should be;

if (evt.getkeycode() == keyevent.vk_space) { 

if cant edit code because generated netbeans, can in form editor. (customize code..)


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -