Skip to content

Check List

eugener edited this page Apr 28, 2013 · 3 revisions

The main idea for this implementation is to be able add "check list" functionality to an existing JList. This way when designing complex UI JList can be used - no need to add any special components.

    JList list = new JList();
    CheckList<String> checkList = new CheckList.Builder(list).build();

In most cases check list data can be represented as a list of items and simply assigned to it using setData method

For more sophisticated cases ICheckListModel interface can be used to create and assign check list model. The library provides DefaultCheckListModel as default implementation of such interface. This implementation should be enough in most situations.

Several important methods are bubbled up from the model to the CheckList class itself for the simplified use:

  • getCheckedItems - returns a collection of checked items.
  • setCheckedItems - resets checked items
  • filter - filters list view without losing actual data

CheckList is used in table filter UI: