boolean (final Rectangle rect) { JScrollPane pane = ComponentUtil.getScrollPane(myTree); if (pane != null) { Rectangle rectangle = SwingUtilities.convertRectangle(myTree, rect, pane.getParent()); return pane.getBounds().contains(rectangle); } return true; }