Here you can find the source of getScrollPane( Component innerComponent)
public static Component getScrollPane( Component innerComponent)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import javax.swing.JScrollPane; public class Main { public static Component getScrollPane(Component innerComponent) /* */{//from w w w . j a v a2 s . co m /* 3190 */Component component = innerComponent; /* 3191 */if ((innerComponent instanceof JScrollPane)) { /* 3192 */return innerComponent; /* */} /* 3194 */if ((component.getParent() != null) && (component.getParent().getParent() != null) && ((component.getParent().getParent() instanceof JScrollPane))) { /* 3195 */component = component.getParent().getParent(); /* 3196 */return component; /* */} /* */ /* 3199 */return null; /* */} }