import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;public class test7 extends JFrame {
    private JTable jTable1;
    public static void main(String[] args) {
        test7 test71 = new test7();
        test71.setSize(500,400);
        test71.setVisible(true);
        test71.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }    public test7() {
        try {
            intiTableData();
            jbInit();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
    public void intiTableData(){
        Vector columName = new Vector();
        columName.addElement("abc");
        columName.addElement("cde");
        columName.addElement("ghk");        Vector data = new Vector();
        for (int i = 0; i < 3; i++) {
            Vector row = new Vector();
            row.addElement("111");
            row.addElement("222");
            row.addElement("333");
            data.addElement(row);
        }
        jTable1 = new JTable(data,columName);
    }
    private void jbInit() throws Exception {
        this.getContentPane().add(new JScrollPane(jTable1), BorderLayout.CENTER);    }
}