void (boolean treeView) { final AntOutputView newView = getOutputView(!treeView); myCurrentView = newView; myCardLayout.show(myContentPanel, newView.getId()); JComponent component = IdeFocusTraversalPolicy.getPreferredFocusedComponent(myMessagePanel); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(component, true)); repaint(); }