sxet table data in java code example

Example: Java table

import javax.swing.*;

public class keywords {
    JFrame f;
    keywords(){
        f=new JFrame();
        String data[][]={ {"abstract","assert","boolean","break"},
                {"byte","case","catch","char"},
                {"class","const","continue","default"},
                {"do","double","else","enum"},
                {"extends","final","finally","float"}};
        String column[]={"Keywords","","",""};
        JTable jt=new JTable(data,column);
        jt.setBounds(30,40,200,300);
        JScrollPane sp=new JScrollPane(jt);
        f.add(sp);
        f.setSize(300,400);
        f.setVisible(true);
    }
    public static void main(String[] args) {
        new keywords();
    }

Tags:

Misc Example