You can't do that as that listener the JTable use to do its stuff.
Anyway I got the solution.
if (event.getValueIsAdjusting()) {
return;
}
-----Original Message-----
From: Ruel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 9:42 PM
To: Bhangale, Bhushan
Cc: [EMAIL PROTECTED]
Subject: Re: ListSelectionListener in JTable
Bhangale, Bhushan wrote:
>So how to get rid of it?
>
>-----Original Message-----
>From: ak [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 12, 2002 6:53 AM
>To: [EMAIL PROTECTED]
>
>
>Subject: RE: ListSelectionListener in JTable
>
>>My listener class :-
>>
>>class TableSelectionListener implements ListSelectionListener {
>> public void valueChanged(ListSelectionEvent event) {
>> if (event.getSource() == table.getSelectionModel() &&
>>table.getRowSelectionAllowed()) {
>> int first = event.getFirstIndex();
>> int last = event.getLastIndex();
>> LogManager.log.debug("Row selection changed = " + first + " " + last);
>> }
>> }
>> }
>>
>>The problem is when I click select a row it calls the listener twice.
>>
>>
>
>may be it called first time for deselecting the last selected row and
>second time for selecting the new row
>
>Regards
>
>Andrei
>
If your classe implements the ListSelectionListener
public void valueChanged(ListSelectionEvent event) {
lsm.removeListSelectionListener(this);
//Your code here.............
lsm.addListSelectionListener(this);
}
"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing