We can retreive JScrollPane’s main JViewport by calling its getViewport() method, or assign it a new one using setViewport(). We can replace the component in this viewport through JScrollPane’s setViewportView() method, but there is no getViewportView() counterpart. Instead we must first access its JScrollPane’s JViewport by calling getViewport(), and then call getView() on that (as discussed above). Typically, to access a JScrollPane’s main child component we would do the following:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.