Practical 8 java

 avatar
Rohit143
java
2 years ago
674 B
2
Indexable
Never
import java.awt.BorderLayout;

import javax.swing.*;

class MyJFrame extends JFrame{
    JTable table;
    String[] heading={"sr","Name","Course"};
    String [][] data={{"1","Rohit","Computer"},{"2","Anuj","Civil"},{"3","Tony","Computer"}};
    MyJFrame(){

        table = new JTable(data,heading);
        add(new JScrollPane(table));
        add(new JLabel("By Rohit Nandagwali"),BorderLayout.NORTH);
        validate();

        setVisible(true);
        setSize(400, 500);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

    }
}

public class practical8 {
    public static void main(String[] args) {
        new MyJFrame();
    }
    
}