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

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -