JComponent () { JBTable table = new JBTable(myModel); table.setShowGrid(false); table.getColumnModel().getColumn(0).setPreferredWidth(JBUI.scale(30)); table.getColumnModel().getColumn(1).setPreferredWidth(JBUI.scale(300)); table.getColumnModel().getColumn(2).setPreferredWidth(JBUI.scale(120)); table.getColumnModel().getColumn(3).setPreferredWidth(JBUI.scale(120)); JBEmptyBorder border = JBUI.Borders.empty(0, 5); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int col) { JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, selected, focused, row, col); label.setBorder(border); label.setHorizontalAlignment(col == 1 ? SwingConstants.LEFT : SwingConstants.RIGHT); if (row >= 0) { DirectoryGroup group = myModel.myGroups.get(row); if (col == 1) { @NlsSafe String paths = group.directories.stream().map(Path::toString).collect(Collectors.joining("<br>", "<html>", "</html>")); label.setToolTipText(paths); } else if (col == 2) { @NlsSafe String isoDate = FileTime.fromMillis(group.lastUpdated).toString(); label.setToolTipText(isoDate); } } return label; } }; table.getColumnModel().getColumn(1).setHeaderRenderer(renderer); table.getColumnModel().getColumn(1).setCellRenderer(renderer); table.getColumnModel().getColumn(2).setHeaderRenderer(renderer); table.getColumnModel().getColumn(2).setCellRenderer(renderer); table.getColumnModel().getColumn(3).setHeaderRenderer(renderer); table.getColumnModel().getColumn(3).setCellRenderer(renderer); myModel.addTableModelListener(e -> updateOkButton()); JPanel panel = new JPanel(new BorderLayout(0, JBUI.scale(5))); panel.add(new JBLabel(message("old.dirs.dialog.text")), BorderLayout.NORTH); JBScrollPane tableScroll = new JBScrollPane(table); table.setFillsViewportHeight(true); panel.add(tableScroll, BorderLayout.CENTER); return panel; }