JComponent (@NotNull TableView<?> table, @NotNull ActionOnSaveInfo info, boolean hovered) { JComponent component = info.getActivatedOnComponent(); Dimension size = component.getPreferredSize(); int baseline = component.getBaseline(size.width, size.height); JCheckBox anchorCheckBox = new JCheckBox(info.getActionOnSaveName()); Dimension cbSize = anchorCheckBox.getPreferredSize(); int baselineDelta = baseline < 0 ? 0 : anchorCheckBox.getBaseline(cbSize.width, cbSize.height) - baseline; JPanel panel = new JPanel(new BorderLayout()); //noinspection UseDPIAwareBorders - baselineDelta is already scaled panel.setBorder(new EmptyBorder(JBUI.scale(ActionOnSaveColumnInfo.TOP_INSET) + baselineDelta, JBUI.scale(8), 0, 0)); panel.add(component, BorderLayout.NORTH); ActionOnSaveColumnInfo.setupTableCellBackground(panel, hovered); return panel; }