Note that there are some explanatory texts on larger screens.

plurals
  1. POis Jlist Override the List automatic? (bug)?
    primarykey
    data
    text
    <p>I hope I will get help, I will ask as general question:</p> <p>I am using a <code>JList</code>, and due to the <code>JList</code> not have a (value,text) (so I can display text and use the value in my code). Because of this leak I create <code>List</code> of object (myList), that work parallel with the <code>JList</code>. Every item I add to <code>JList</code> I add to <code>myList</code>, so the same index will contain the same info in the two objects (JList and mylist) I use the <code>JList.getselectedindex()</code> method to get the index and use it in <code>myList</code> to pup information...</p> <p><strong>The problem:</strong> is when I select value, the next value of the <code>myList</code> is overridden with the first value!!! Is this problem known?</p> <pre><code> mod_mp = new ModelMAPPING(); objects cotain values that ot exist in jList msgF.setTo(incom.userID);/////// set parter! if(isExCon==-1) { // not exist mod_mp.to = incom.userID; // incom is object that incom from another program mod_mp.SetCovFile(incom.userID+".html"); mod_mp.ConvName = incom.getBody(); boolean added= model_list.add(mod_mp); // add to mylist if(added) System.out.println(mod_mp._Hfile + " added"); model.addElement(mod_mp.ConvName);// add to Jlist by model HestoryFile(Htmlhead+tohis,mod_mp._Hfile);//create _Hfile and write to it:"tohis" string. } else { //exist@ // note isExcon return the index if exist else -1 model_list.get(isExCon).ConvName=incom.getBody(); mod_mp.SetCovFile(model_list.get(isExCon)._Hfile); HestoryFile(tohis, model_list.get(isExCon)._Hfile); }//end else </code></pre> <p>Here if file exists I just update the new text in the <code>JList</code> and set the current file</p> <p>The select of <code>JList</code> is:</p> <pre><code>msgF.setTo (model_list.get(jList2.getSelectedIndex()).to); // set that we will send To... mod_mp.SetCovFile(model_list.get(jList2.getSelectedIndex())._Hfile);//set the file jLabel5.setText( bringFromFile(mod_mp._Hfile));//tell the label to read that file </code></pre> <p>It works fine, but when I have two items in <code>JList</code> if I select any, the other is overridden!!! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload