Article View: borland.public.jbuilder.java.language
Article #18398JTable and ListSelectionEvent
From: Kimmo P�ntiskoski
Date: Thu, 25 Jun 1998 00:00
Date: Thu, 25 Jun 1998 00:00
29 lines
1478 bytes
1478 bytes
I have JTable in my application and I want to know when selection is
changed. So I implemented it like this:
JTable table;
table = new JTable(dataModel);
ListSelectionModel selectionModel = table.getSelectionModel();
selectionModel.addListSelectionListener(this);
The class implement ListSelectionListener which has only one method:
public void valueChanged(ListSelectionEvent parm1) {
System.out.println("selection event");
}
If I set the selection mode of the JTable to be column selection like
this
table.setRowSelectionAllowed(false);
table.setColumnSelectionAllowed(true);
the valueChanged method is not called every time when selection changes.
For Example if I select multiple columns by click the same row in every
column, event is not fired. Any ideas why ? To me it is important to
know if there is multiple or singe selection of the columns.
So am I doing something wrong or is this a bug?
Kimmo P�ntiskoski
Technical Details
Message-ID:
<359250F1.6DEA68DB@igd.fhg.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,286f9afe986a93df,start X-Google-Attributes: gidf74b3,public From: "Kimmo P�ntiskoski" <pontisko@igd.fhg.de> Subject: JTable and ListSelectionEvent Date: 1998/06/25 Message-ID: <359250F1.6DEA68DB@igd.fhg.de> X-Deja-AN: 365964625 Content-Transfer-Encoding: 8bit Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language