0

I'll cut to the chase. I'm try to add Toedter's JDateChooser in a column of a JTable. My app is using MVC pattern, this is from my View:

scrollPanePermits = new JScrollPane();
        tableVehiclePermitHeader = new String[] {"Name", "Expiration Date"};
        tableVehiclePermitData = new Object [0][0];
        tableVehiclePermitDefaultTableModel = new DefaultTableModel(tableVehiclePermitData, tableVehiclePermitHeader);
        tableVehiclePermit = new JTable(tableVehiclePermitDefaultTableModel){
//          public Class getColumnClass(int c) {
//              return getValueAt(0, c).getClass();
//           }
            public Class getColumClass(int c){
                if(c == 0){
                    return String.class;
                } else if (c == 1){
                    return JDateChooser.class;
                }
                return null;
            }
            public boolean isCellEditable(int rowIndex, int colIndex){
                if (colIndex == 0){
                    return false;
                } else {
                    return true;
                }
            }
        };

I honestly have no way to go about it, so any help would be greatly appreciated.

Regards.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Shalin
  • 105
  • 2
  • 14

1 Answers1

1

I've never tried it, but you might start with Concepts: Editors and Renderers. Here's a related example using Double and a thread about using JDateChooser.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045