Hello,
Is it possible before adding a new element to the Jlist to "clear" the already made
selection in the Jlist ?
That would solve my problem I'm having.
Because when I already have made a selection in the Jlist and then add a new element, the
ListEvenListner doesn't know where the index is anymore.
I always get an exception java.lang.ArrayIndexOutOfBoundsException -1.
I do not have this problem when I add a new element without having selected something in the
Jlist first.
Only when I select something by means of a mouseclick, then I get an exception when adding a
new elment.
Hope this is clear.
I also work with a defaultListmodel which contains the data of the list and with a Vector which
contains the other data necessary to fill other Jtextfields.
Thanks for any reply.
FYI
Here's my listener :
private void veldenListSelected1(javax.swing.event.ListSelectionEvent evt) {
tfVeldNaam.setText((
String)veldenList.getSelectedValue());
cbType.setSelectedIndex(((Veld)rows.elementAt(veldenList.getSelectedIndex())).getType());
cbType.setSelectedIndex(((Veld)rows.elementAt(veldenList.getSelectedIndex())).getType());
tfLengte.setText(new Integer(((Veld)rows.elementAt(veldenList.getSelectedIndex())).getLengte()).toString());
veldDetails.setText(((Veld)rows.elementAt(veldenList.getSelectedIndex())).getOmschrijving());
Kristof