Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hayrah Burki   on Jan 18 In Java Category.

  
Question Answered By: Isaac Evans   on Jan 18

Make sure that getSelectedValue() is not null. If list  is a JList
object and the selection is empty, null will be returned.

Try something like this
MouseListener mouseListener = new MouseAdapter() {
public void  mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
int index = list.locationToIndex(e.getPoint());
list.setSelectedIndex(index);
skinname = list.getSelectedValue().toString() ;
}}};
list.addMouseListener(mouseListener);

For more details on JList
java.sun.com/.../JList.html

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on java actionlistener Or get search suggestion and latest updates.


Tagged: