void (@NotNull ActiveComponent component, @Nullable Border border) { if (myButtonComponent != null) { remove(myButtonComponent.getComponent()); } JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(border); panel.add(new JLabel(" "), BorderLayout.WEST); panel.add(component.getComponent(), BorderLayout.CENTER); panel.setOpaque(false); add(panel, BorderLayout.EAST); myButtonComponent = component; }