I must confess I find JList one of the most frustrating gadgets in Swing. (Actually I find Swing a pain in the neck, generally, but it has its moments. I quite like JTable, for example).
The DEFAUL behaviouor of JList is pretty useless - you can have a fixed list of stuff. No adds, no changes.
You do this by declaring a JList with an array of Strings like this:
String[]
patterns = {
"this",
"that",
"the other"};
private JList jList = new JList(patterns);
Lo and behold. But you can't CHANGE anything.
Nah, to do that, you have to use a DefaultListModel.
DefaultListModel info = new DefaultListModel();
JList jList = new JList(info); //default used does not allow changes!!! Use a DefaultListModel like this - which does ...
you can add stuff in like this:
info.addElement("new list entry");
That should get you started. Enjoy. Try not to get too cross with the model (I know I did).
Simon (who is calmer, these days)