void (int increment) { int maxHeight = super.preferredLayoutSize(myTarget).height - getMaxHeight(); int newShift = Math.max(0, Math.min(maxHeight, myShift + increment)); if (newShift != myShift) { myShift = newShift; myTarget.revalidate(); myTarget.repaint(); Window w = ComponentUtil.getWindow(myTarget.getComponent()); if (w != null) { for (Window window : w.getOwnedWindows()) { window.dispose(); } } } }