Package weka.gui

Class CheckBoxList

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class CheckBoxList extends JList
An extended JList that contains CheckBoxes. If necessary a CheckBoxListItem wrapper is added around the displayed object in any of the Model methods, e.g., addElement. For methods returning objects the opposite takes place, the wrapper is removed and only the payload object is returned.
Version:
$Revision: 10219 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Constructor Details

    • CheckBoxList

      public CheckBoxList()
      initializes the list with an empty CheckBoxListModel
    • CheckBoxList

      public CheckBoxList(CheckBoxList.CheckBoxListModel model)
      initializes the list with the given CheckBoxListModel
      Parameters:
      model - the model to initialize with
  • Method Details

    • setModel

      public void setModel(ListModel model)
      sets the model - must be an instance of CheckBoxListModel
      Overrides:
      setModel in class JList
      Parameters:
      model - the model to use
      Throws:
      IllegalArgumentException - if the model is not an instance of CheckBoxListModel
      See Also:
    • setListData

      public void setListData(Object[] listData)
      Constructs a CheckBoxListModel from an array of objects and then applies setModel to it.
      Overrides:
      setListData in class JList
      Parameters:
      listData - the data to use
    • setListData

      public void setListData(Vector listData)
      Constructs a CheckBoxListModel from a Vector and then applies setModel to it.
      Overrides:
      setListData in class JList
    • getChecked

      public boolean getChecked(int index)
      returns the checked state of the element at the given index
      Parameters:
      index - the index of the element to return the checked state for
      Returns:
      the checked state of the specifed element
    • setChecked

      public void setChecked(int index, boolean checked)
      sets the checked state of the element at the given index
      Parameters:
      index - the index of the element to set the checked state for
      checked - the new checked state
    • getCheckedIndices

      public int[] getCheckedIndices()
      returns an array with the indices of all checked items
      Returns:
      the indices of all items that are currently checked