Java awt.list ActionListener single click -


i have list of cities. when click on city shows current time, date etc.. city

however updates when double click on city how go changing single click

thanks

 @override public void itemstatechanged(itemevent e) {     set<string> countries = regionmap.get(listregion.getselecteditem());     listsubregion.removeall();     for(string country : countries)     {         listsubregion.add(country);     }      selectedregion = listregion.getselecteditem();      listsubregion.validate();     listsubregion.repaint();      repaint(); } 

try this:

list.addmouselistener(new mouseadapter() {     public void mouseclicked(mouseevent e) {         if (mouseevent.getclickcount() == 1) {             // single click             int index = thelist.locationtoindex(mouseevent.getpoint());             if (index >= 0) {                 object o = thelist.getmodel().getelementat(index);                 ... ...                         }         }     } }); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -