String src;  if (oldAcc.registered) src = "gui/resources/green.gif"; else src = "gui/resources/red.gif";  ImageIcon img = new ImageIcon(cl .getResource(src)); params.clear(); params.add(oldAccId); params.add("name"); img.setDescription((String) execute( "core.accountGet", params) + " (# "+ oldAcc.id +")"); list1.set(oldIndex, img);
    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {        if (justSelect) {            justSelect = false;        } else {            int i = jList1.getSelectedIndex();            if (i > -1) {                Account acc = (Account) accounts.elementAt(i);                actacc = acc;                Integer accId = new Integer(acc.id);                            if (acc.registered) {                    popup_register.setText("Unregister");                } else {                    popup_register.setText("Register");                }                if (modified && oldIndex > -1) {                    Object[] options = { "Yes", "No (changes will be lost)",                            "Cancel" };                    int n = JOptionPane.showOptionDialog(this,                            "You have modified some values. "                                    + "Do you want to save them now?",                            "Warning", JOptionPane.YES_NO_CANCEL_OPTION,                            JOptionPane.WARNING_MESSAGE, null, options,                            options[0]);                                        if (n == 0) {                        if (oldIndex != -1) {                            Account oldAcc = (Account) accounts                                    .elementAt(oldIndex);                            Integer oldAccId = new Integer(oldAcc.id);                                                       setValues(oldAccId);                        }                        modified = false;                        jButton3.setEnabled(false);                        restoreColor();                        oldIndex = -1;                        getValues(accId);                    } else if (n == 1) {                        modified = false;                        getValues(accId);                        restoreColor();                        oldIndex = -1;                    } else {                        justSelect = true;                        if (oldIndex != -1) {                            jList1.setSelectedIndex(oldIndex);                        }                    }                } else {                    getValues(accId);                }            } else {                actacc = null;            }        }        oldIndex = jList1.getSelectedIndex();    }