if (data instanceof ImageSummary) {
if (data instanceof ImageData) {
    private void addRow(GridBagLayout gridbag, GridBagConstraints c,                         JPanel main, int index, DataObject data)    {        //The image has not been classified.        if (data instanceof ImageSummary) {            main.add(new JLabel(UNCLASSIFIED_TEXT));            return;        }        JCheckBox box = new JCheckBox();        box.setSelected(true);        String name = "";        if (data instanceof CategoryGroupData) {            CategoryGroupData cg = (CategoryGroupData) data;            name += cg.getName()+">";            Set set = cg.getCategories();            if (set.size() == 1) {                final CategoryData category = (CategoryData) (set.toArray()[0]);                name += category.getName();                box.addItemListener(new ItemListener() {                    public void itemStateChanged(ItemEvent e)                    {                        setSelectedCategory(category);                    }                });            }        } else if (data instanceof CategoryData) {             //i.e. the Category is orphan, shouldn't happen            final CategoryData category = (CategoryData) data;            name += category.getName();            box.addItemListener(new ItemListener() {                public void itemStateChanged(ItemEvent e)                {                    setSelectedCategory(category);                }            });        }        //init JLabel        JLabel label = new JLabel(name);        c.gridx = 0;        c.gridy = index;        gridbag.setConstraints(box, c);        main.add(box);        c.gridx = 1;        gridbag.setConstraints(label, c);        main.add(label);    }