Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


NIJIN P P
problem in using getKeyCode()
0 Answer(s)      3 years and 2 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:
 

 

 

DMCA.com