Java JTable add to JScrollPane
import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class Main { public static void main(String[] args) { JFrame f = new JFrame("JTable example"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //from ww w. j a v a2 s . c o m String[] columnNames = { "Ordinal" }; String[][] tableData = {{ "One" }, // { "Two" },// { "Three" } }; JTable table = new JTable(tableData, columnNames); f.add(new JScrollPane(table)); f.pack(); f.setVisible(true); } }