void (ComponentEvent e) { var minWidth = 0; for(var component: rightPanel.getComponents()){ minWidth += component.getPreferredSize().width; } rightPanel.setMinimumSize(new Dimension(minWidth, 0)); mySplitter.updateUI(); }