Hi!
Is it possible to dynamically update a text of items in JList? Let's say there is JList defined as follows:
list1.setModel(new AbstractListModel() {
Object[] values = listOfTasks.toArray();
public int getSize() { return values.length; }
public Object getElementAt(int i) { return "Task " + i; }
});
As a result, let's say JList includes as following data:
X1
X2
X2
After pressing on JButton, an item in JList must be renamed to "Y". The problem is that I cannot find a procedure like "setElementAt" or something similar. So, how could I solve this problem?
P.S.: I tried to include the following procedure to AbstractListModel, but it didn't help:
public void setValueAt(int i) { values = "Y";