NIJIN P P
problem in using getKeyCode()
0 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners

i am working with the jlist...while i was trying to use the arrow keys in the keyboard to select the values in the list it is not working properly...the code which i used is given below....

if (evt.getKeyCode() == KeyEvent.VK_DOWN) { // Do stuff. if (jList.getSelectedIndex() == lsm.getSize() - 1) {/lsm is the default list model/ jList.setSelectedIndex(0); jList.setVisible(false); } else { jList.setSelectedIndex(jList.getSelectedIndex() + 1); } }

Advertisement
View Answers









Related Tutorials/Questions & Answers: