How to get last change item in JList?

If we change/select list items by mouse, we can get it by implementing MouseListener interface and in mouseClicked() method by calling JList..locationToIndex(MouseEvent.getPoint()) method.

But how to achieve this if change/ select JList items by keyboard?

for KeyListener there is no such method to change item Point.

Thanks in advance,

Vikas

[373 byte] By [vikas_foruma] at [2007-11-27 9:36:44]
# 1
*Shudder*Use a ListSelectionListener http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/event/ListSelectionListener.html
PhHeina at 2007-7-12 23:06:30 > top of Java-index,Desktop,Core GUI APIs...
# 2
using listselectionlistener: http://java.sun.com/docs/books/tutorial/uiswing/events/listselectionlistener.html
Yannixa at 2007-7-12 23:06:30 > top of Java-index,Desktop,Core GUI APIs...
# 3

I also tried listselectionlistener valuechanged() method.

this calls for list selection change, but I want to find out last selection changed item.

I also tried ListSelectionEvent getFirstIndex() and getLastIndex() method, but it also doens't give exact last selection change item.

vikas_foruma at 2007-7-12 23:06:30 > top of Java-index,Desktop,Core GUI APIs...