
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); } }
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.