Problem with the following program...pls help...

Joined
Oct 17, 2010
Messages
1
Reaction score
0
import java.awt.event.*;
import javax.swing.*;

public class JTableExample extends JFrame{

String data[][]={{"John","Sunderland","Student"},
{"George","Davies","Student"},
{"Melissa","Anderson","Associate"},
{"Stergios","Maglaras","Developer"},
};

String fields[]={"Name","Surname","Status"};

public static void main(String[] argv) {
JTableExample myExample = new JTableExample("JTable Example");
}

public JTableExample(String title){
super(title);
setSize(150,150);
addWindowListener(new WindowAdaptor(){
public void windowClosing( WindowEvent we) {
dispose();
System.exit(0);
}});
init();
pack();
setVisible(true);
}

private void init() {
JTable jt = new JTable( data, fields );
JScrollPane pane = new JScrollPane(jt);
getContentPane().add(pane);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top