JList click event
Hi all,
I have a JList and I would like to go somthing when an item is selected.
So I implemented a ListSelectionEvent and done the following code:
publicvoid valueChanged(ListSelectionEvent e){
if (e.getSource().equals(itemList)){
//do somthing
}
THIS IS WORKING... however not with a whole click of the mouse. It is executed when I click the mouse and executed again when I release the mouse. I would like this to work with a whole click (down and up)
Thanks for the help :)
[742 byte] By [
Xenobiusa] at [2007-11-26 23:59:51]

it shouldn't, are you changing the list selection in the method? Try looking through the API for the differant listeners for JList, ActionListener should be what you want if you only want mouse clicks. ActionListener activates no matter where you click on the JList though, so even if they don't change anything it would execute.
Well guys,I still have such a problem that when I click on an item, the event is executed both when the mouse is pressed and again when the mouse is released, HOWEVER my code is working fine and am not gonna bother it hehe But thanks a lot! :)