Java tutorial
import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class MainClass { public static void main(String args[]) { JFrame f = new JFrame("JTable Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Object rows[][] = { { "A", "Name 1", "38.94" }, { "B", "Name 2", "7.70" }, { "C", "Name 3", "112.65" } }; Object columns[] = { "Symbol", "Name", "Price" }; JTable table = new JTable(rows, columns); JScrollPane scrollPane = new JScrollPane(table); f.add(scrollPane, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); } }