import javax.swing.*;
import java.awt.*;
import javax.swing.tree.*;
import java.awt.event.*;
/*<applet code="JTabledemo" width=400 height=200></applet>*/
public class JTabledemo extends JApplet
{
public void init()
{
Container c=getContentPane();
c.setLayout(new BorderLayout());
String[] colHeads={"name","phone no","city"};
Object[][] data={
{"abc","9999999","pune"},
{"xyz","8888888","mumbai"}
};
JTable tb=new JTable(data,colHeads);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(tb,v,h);
c.add(jsp,BorderLayout.CENTER);
}
}
import java.awt.*;
import javax.swing.tree.*;
import java.awt.event.*;
/*<applet code="JTabledemo" width=400 height=200></applet>*/
public class JTabledemo extends JApplet
{
public void init()
{
Container c=getContentPane();
c.setLayout(new BorderLayout());
String[] colHeads={"name","phone no","city"};
Object[][] data={
{"abc","9999999","pune"},
{"xyz","8888888","mumbai"}
};
JTable tb=new JTable(data,colHeads);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(tb,v,h);
c.add(jsp,BorderLayout.CENTER);
}
}
No comments:
Post a Comment