Issue changing value in ArrayList from GUI

iPros

New Member
I have an ArrayList called conditionList which stores condition names.Whenever one is added/edited or deleted, the Lists on my GUI update no problems. You can see below that i use 2 models... a DefaultListModel called condListModel and a DefaultComboBoxModel called conditionModel.The code i have below is for the method editCondition(), at this stage the text is already changed on the GUI and is being submitted here. On my GUI, after ive submitted the change, the ComboBox and JList change no problem so im sure that the model changes are correct.HOWEVER MY PROBLEM IS: When i save the ArrayList conditionList through serialization, and then load it back up, the change is gone. SO I think there is problem in my code with changing the String Value in the ArrayList(named conditionList), can anyone have a look and see if u notice an issue\[code\]String conString = jListCondition.getSelectedValue().toString(); for(String c: conditionList) { if(conString.compareTo(c) == 0) { String temp = entConName.getText(); c = temp; //edit the Condition jList model int x = condListModel.indexOf(conString); condListModel.setElementAt(temp, x); jListCondition.setModel(condListModel); //edit the Condition comboBox model int i = conditionModel.getIndexOf(conString); conditionModel.insertElementAt(temp, i); conditionModel.removeElement(conString); entCondition.setModel(conditionModel); //reset buttons editConConfirm.setEnabled(false); editCon.setEnabled(false); deleteCon.setEnabled(false); entConName.setText(""); addCon.setEnabled(true); } }\[/code\]
 
Back
Top