More specifically, I would use a DefaultListModel object, since it is already wired to do what you want.

12-16-2009, 01:23 PM

Desperado

Seems that it is a problem with creating another list model, since I am using
3rd party Jidesoft swing library for creating CheckBoxList
http: // bit<dot>ly/ 53LuX6
And I really don't know how define different list model there. However, it is possible to download source code of jidesoft swing (but how to compile it in jar later?)

Here is the code of my app where I am working with the list( sorry, it is way too dirty)

/
// If it is a directory, make sure it is empty
if (f.isDirectory()) {
String[] files = f.list();
if (files.length > 0)
throw new IllegalArgumentException(
"Delete: directory not empty: " + fileName);
}

Can anybody actually give a clue about that?
I would appreciate it very much!

12-16-2009, 06:40 PM

zweibieren

From the "Members" tab of page CheckBoxList we can see that CheckBoxList has a constructor that takes a ListModel as an argument. Your application can create the CheckBoxList with a DefaultListModel as its model. and then modify the model via addElement and removeElement. (The elements are the String file names.)

12-16-2009, 06:48 PM

camickr

Quote:

Seems that it is a problem with creating another list model, since I am using 3rd party Jidesoft swing library for creating CheckBoxList

Yes, that would be the problem. You should be using a JTable, not a JList to show checkboxes. A JList was not designed to be editable.

12-17-2009, 11:58 AM

Desperado

Quote:

Originally Posted by zweibieren

Your application can create the CheckBoxList with a DefaultListModel as its model. and then modify the model via addElement and removeElement. (The elements are the String file names.)