void (boolean show) { if (show) { if (!isTransparentPaneExist()) { myPane.add(myTransparentPane); } else { myPreviouslyFocusedComponent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); } myTransparentPane.add(myWrapperPane); myTransparentPane.setLayer(myWrapperPane, myTransparentPane.getComponentCount() - 1); if (!myTransparentPane.isVisible()) { myTransparentPane.setVisible(true); } } super.setVisible(show); if (show) { myTransparentPane.revalidate(); myTransparentPane.repaint(); } else { myTransparentPane.remove(myWrapperPane); myTransparentPane.revalidate(); myTransparentPane.repaint(); if (myPreviouslyFocusedComponent != null) { Component component = myPreviouslyFocusedComponent; IdeFocusManager.getGlobalInstance() .doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(component, true)); myPreviouslyFocusedComponent = null; } if (myTransparentPane.getComponentCount() == 0) { myTransparentPane.setVisible(false); myPane.remove(myTransparentPane); } } }