Adding a Table to a Container It's easy to put a table in a scroll pane. You need just one or two lines of code: JScrollPane scrollPane = new JScrollPane(table); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); The scroll pane automatically gets the table's header, which displays the column names, and puts it on top of the table. ...