mardi 16 juin 2015

Add checkBox to JTable in java swing [duplicate]

This question already has an answer here:

I want to have more choices, Please help me do it

        TableCellRenderer renderer = new TableCellRenderer() {
        JCheckBox check = new JCheckBox();
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            if(check == null)
                return null;
            //check.setSelected((Boolean)value); // ClassCastException;
            check.setSelected(isSelected);
            return check;
        }

    };




Aucun commentaire:

Enregistrer un commentaire