/** Constructor. */
    public FileChooserCellEditor() {
      super(new JTextField());
      setClickCountToStart(CLICK_COUNT_TO_START);

      // Using a JButton as the editor component
      button = new JButton();
      button.setBackground(Color.white);
      button.setFont(button.getFont().deriveFont(Font.PLAIN));
      button.setBorder(null);

      // Dialog which will do the actual editing
      fileChooser = new JFileChooser();
      fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   file = value.toString();
   SwingUtilities.invokeLater(
       () -> {
         fileChooser.setSelectedFile(new File(file));
         if (fileChooser.showOpenDialog(button) == JFileChooser.APPROVE_OPTION) {
           file = fileChooser.getSelectedFile().getAbsolutePath();
         }
         fireEditingStopped();
       });
   button.setText(file);
   return button;
 }