JPanel (@NotNull JComponent title, @NotNull JComponent checkbox) { JPanel topPanel = new CaptionPanel(); topPanel.add(title, BorderLayout.WEST); topPanel.add(checkbox, BorderLayout.EAST); Dimension size = topPanel.getPreferredSize(); size.height = JBUIScale.scale(29); topPanel.setPreferredSize(size); topPanel.setBorder(JBUI.Borders.empty(5, 8)); new WindowMoveListener(topPanel).installTo(topPanel); return topPanel; }