0

I have a JTable and I fill it with an Object[][] array. This array contains boolean and String values, but table does not show checkboxes (just true or false).

My code is:

    model =
                    new DefaultTableModel(pinFin, colNames) { 
                public Class<?> getColumnClass(int column) {
                    String type = h.getColumnsType().get(column);

                    if(type.equals("L") || type.equals("l"))
                        return Boolean.class;
                    else
                        return String.class;

                }
            };

data_table = new JTable()
    {
        public boolean isCellEditable(int row, int column) {                
            return false;               
        };
    };
data_table.setModel(model);

What is wrong?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user1005633
  • 625
  • 3
  • 9
  • 23
  • Why not fill the array with values having the desired type? – trashgod Jun 15 '13 at 10:35
  • I did it, the array is not string is object. For example i put a boolean value like that: pinFin[row][d] = true;.... – user1005633 Jun 15 '13 at 10:49
  • 2
    Here's a working [example](http://stackoverflow.com/a/4528604/230513). – trashgod Jun 15 '13 at 11:23
  • @user1005633 and to move isCellditable to the model too – mKorbel Jun 15 '13 at 15:20
  • 1
    `What is wrong?` - We are not mind readers. The posted code doesn't tell us anything. We don't know what `h.getColumnsType().get(column);` does. We don't know how you use the table in your program. Post a `SSCCE` that demonstrates your problem. – camickr Jun 15 '13 at 16:08

0 Answers0