public void loadTypes(Map<Object, Boolean> items) { getTypesPanel().removeAll(); if (items.size() > 0) { // sort the types alphabetically TreeSet<Object> sortedTypes = new TreeSet<Object>(new ToStringComparator()); sortedTypes.addAll(items.keySet()); for (Object type : sortedTypes) { boolean selected = items.get(type); FilterCheckBox checkbox = new FilterCheckBox(type, null, selected) { private static final long serialVersionUID = -861175558062891232L; public void typeVisibilityChanged(Object type, boolean visible) { FilterPanel.this.typeVisibilityChanged(type, visible); } }; // create an icon for this type - it will be a rounded rectangle // filled with the same color/paint as the node or arc type Icon icon = style.getThumbnail(type, ICON_WIDTH, ICON_HEIGHT); checkbox.setIcon(icon); getTypesPanel().add(checkbox); } } this.invalidate(); this.validate(); this.repaint(); }