void (@Nullable final JPanel panel) { if (panel == null) { if (myDetailPanelWrapper != null) { myDetailPanelWrapper.removeAll(); } myLabel.setText(myEmptyLabel); add(myLabel, BorderLayout.CENTER); } else if (panel != myDetailPanel) { remove(myLabel); if (myDetailPanelWrapper == null) { myDetailPanelWrapper = new JPanel(new GridLayout(1, 1)); myDetailPanelWrapper.setBorder(JBUI.Borders.empty(5)); myDetailPanelWrapper.add(panel); add(myDetailPanelWrapper, BorderLayout.NORTH); } else { myDetailPanelWrapper.removeAll(); myDetailPanelWrapper.add(panel); } } myDetailPanel = panel; revalidate(); repaint(); }