void (ComponentEvent e) { Dimension size = myToolWindowPanel.getSize(); boolean newVertical = size.width < size.height; if (myToolWindowPanel.getOrientation() != newVertical) { myToolWindowPanel.setOrientation(newVertical); } }