JComponent () { final String[] names = { JavaCompilerBundle.message("exclude.from.compile.table.path.column.name"), JavaCompilerBundle.message("exclude.from.compile.table.recursively.column.name") }; // Create a model of the data. TableModel dataModel = new AbstractTableModel() { @Override public int getColumnCount() { return names.length; } @Override public int getRowCount() { return myExcludeEntryDescriptions.size(); } @Override public Object getValueAt(int row, int col) { ExcludeEntryDescription description = myExcludeEntryDescriptions.get(row); if(col == 0) { return description.getPresentableUrl(); } if(col == 1) { if(!description.isFile()) { return description.isIncludeSubdirectories(); } else { return null; } } return null; } @Override public String getColumnName(int column) { return names[column]; } @Override public Class getColumnClass(int c) { if(c == 0) { return String.class; } if(c == 1) { return Boolean.class; } return null; } @Override public boolean isCellEditable(int row, int col) { if(col == 1) { ExcludeEntryDescription description = myExcludeEntryDescriptions.get(row); return !description.isFile(); } return true; } @Override public void setValueAt(Object aValue, int row, int col) { ExcludeEntryDescription description = myExcludeEntryDescriptions.get(row); if (col == 1) { description.setIncludeSubdirectories(aValue.equals(Boolean.TRUE)); } else { final String path = (String)aValue; description.setPresentableUrl(path); } } }; myExcludedTable = new JBTable(dataModel); myExcludedTable.setShowGrid(false); myExcludedTable.setEnableAntialiasing(true); myExcludedTable.getEmptyText().setText(JavaCompilerBundle.message("no.excludes")); myExcludedTable.setPreferredScrollableViewportSize(JBUI.size(300, -1)); myExcludedTable.setVisibleRowCount(6); myExcludedTable.setDefaultRenderer(Boolean.class, new BooleanRenderer()); myExcludedTable.setDefaultRenderer(Object.class, new MyObjectRenderer()); myExcludedTable.getColumn(names[0]).setPreferredWidth(350); final int cbWidth = 15 + myExcludedTable.getTableHeader().getFontMetrics(myExcludedTable.getTableHeader().getFont()).stringWidth(names[1]); final TableColumn cbColumn = myExcludedTable.getColumn(names[1]); cbColumn.setPreferredWidth(cbWidth); cbColumn.setMaxWidth(cbWidth); myExcludedTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); myExcludedTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { myRemoveButton.setEnabled(myExcludedTable.getSelectedRow() >= 0); } }); TableCellEditor editor = myExcludedTable.getDefaultEditor(String.class); if(editor instanceof DefaultCellEditor) { ((DefaultCellEditor)editor).setClickCountToStart(1); } return ToolbarDecorator.createDecorator(myExcludedTable) .disableUpAction() .disableDownAction() .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton anActionButton) { addPath(myDescriptor); } }) .setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton anActionButton) { removePaths(); } }).createPanel(); //return ScrollPaneFactory.createScrollPane(myExcludedTable); }