Why we've to add a scroll pane into a panel before adding a panel into frame
Posted on 2012-04-12
We're writing Java programs with Swing.
In the program, we access a database, get the data, populate a table with the data.
In order to display the table, we add the table into a scroll pane, then add the scroll pane into a panel, and finally add the panel to the frame. It works.
If we added the scroll pane directly to the frame, it didn't work, i.e. the table is not displayed.
Why do we've to use the panel?
Why the data is not displayed if we add the scroll pane directly to the frame?
If you've any idea about this, please help.
Thanks so much,