void (@NotNull String card, boolean keepFocus) { if (Objects.equals(myCurrentCard, card)) return; Runnable task = () -> { myCardLayout.show(myContentPanel, card); myCurrentCard = card; UIUtil.layoutRecursively(myContentPanel); myContentPanel.repaint(); }; if (keepFocus) { DiffUtil.runPreservingFocus(myContext, task); } else { task.run(); } }