I have a problem with Jtable and my dataModel. My table model extends AbstracttableModel, the data is stored in a vector. I have a function that involves deleting one or more lines. These lines do not have to be contiguous because my jtable set selectionMode as follows:
jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
Row deletion function (one by one):
public void removeMessageRow(Integer p_idMessage) { Enumeration<MlMessage> alldatas = vData.elements(); while (alldatas.hasMoreElements()) { MlMessage m = alldatas.nextElement(); if (m.getIdMessage() == p_idMessage) { int idx = vData.indexOf(m); boolean result = vData.remove(m);
When I run the function, I run the loop without problems, in step-by-step mode I can see that the vData object is updated, and if I execute it only once, there are no problems with the GUI. The problem occurs when I select multiple rows. For example, I selected row number 0 and number 1 in my table, and I executed the removeMessageRow function, the first time vDataObject was updated correctly (all data is turned upside down and the last elements of this vector are set to zero, call vData.remove(m)
. Therefore, in In my case, I expect that on the second run, the object that should be found should be in position 0, but in position 1 as a vData object, it has never been updated. Does anyone have an idea about this? I tried a lot on fire .. Something but no one could execute immediately. Thanks for any help in advance and sorry for my Shakespeare language.
source share