Home Answers Viewqa Java-Beginners problem in using getKeyCode()

 
 


NIJIN P P
problem in using getKeyCode()
0 Answer(s)      a year and 8 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); } }

View Answers









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.