Package com.compomics.util.gui
Class CheckBoxCellRenderer<E extends CheckableItem>
java.lang.Object
com.compomics.util.gui.CheckBoxCellRenderer<E>
- Type Parameters:
E- the checkable item
- All Implemented Interfaces:
ListCellRenderer<E>
public class CheckBoxCellRenderer<E extends CheckableItem>
extends Object
implements ListCellRenderer<E>
Cell renderer for JComboBox supporting multiple selection. Based on
https://java-swing-tips.blogspot.com/2016/07/select-multiple-jcheckbox-in-jcombobox.html.
- Author:
- Harald Barsnes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCheckedItems(ListModel model) Returns the checked items as an array of strings.getListCellRendererComponent(JList list, CheckableItem value, int index, boolean isSelected, boolean cellHasFocus) voidsetCheckedItem(ListModel model, String itemName) Checks the item with the given name in the list.
-
Constructor Details
-
CheckBoxCellRenderer
public CheckBoxCellRenderer()
-
-
Method Details
-
getListCellRendererComponent
public Component getListCellRendererComponent(JList list, CheckableItem value, int index, boolean isSelected, boolean cellHasFocus) - Specified by:
getListCellRendererComponentin interfaceListCellRenderer<E extends CheckableItem>
-
getCheckedItems
Returns the checked items as an array of strings.- Parameters:
model- the list model- Returns:
- the checked items as an array of strings
-
setCheckedItem
Checks the item with the given name in the list.- Parameters:
model- the list modelitemName- the name of the item to check
-