import java.awt.*;
import javax.swing.*;
public class JTable extends JFrame
{
public void init()
{
Container c=getContentPane();
c.setLayout(new BorderLayout());
c.setBackground(Color.yellow);
c.setForeground(Color.green);
c.setFont(new Font("Font.sans-serif", Font.PLAIN, 30));
String colHd[] = {"name", "qualification", "course"};
String data[][]={
{"a","lkg","alfa"},
{"b","ukg","beta"},
{"c","1st","gama"}
};
JTable jt = new JTable(data,colHd);
int V = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int H = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane
jsp = new JScrollPane(jt,V,H);
c.add(jsp, BorderLayout.CENTER);
}
}