java - Difference between JScrollPane.setviewportview vs JScrollPane.add -


i faced new thing today, , didn't know why. when want show in panel example, add panel; why cannot add table scroll pane directly, , why have call setviewportview() method? add() method , setviewprotview() do?

basically, should not use jscrollpane#add.

jscrollpane has single component attached it, jviewport, jscrollpane uses display component added view port.

enter image description here

setviewportview convenience method for jscrollpane#getviewport#setview

the basic concept comes down fact scroll panes point of view, show single component, add doesn't make sense it. method consequence of extending jcomponent -> container


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -