Saturday, February 4, 2012

Table

import javax.swing.*;
import java.awt.*;

public class Table extends JFrame
{
 Object[][] cells={{"ABC",999999},{"XYZ",999900},{"ABC",999999},{"XYZ",999900},{"ABC",999999}};
 String[] columnName={"Name","Employee ID"};
 JTable table=new JTable(cells,columnName);
 JScrollPane pane=new JScrollPane(table);
 Container con;
  
 Table()
 {
  super("LOG IN");con=getContentPane();
  setSize(200,200);
  setLayout(null);
        pane.setBounds(20,20,150,100);
  con.add(pane);
        setVisible(true);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            
        }
 public static void main(String s[])
 {
  Table obj=new Table();
 }
}
Output:-

No comments: