DefaultTableModel problem
hello guys.. I m trying to create a graphic table useing the class DefaultTableModel.
So, the problem is that it does not print the title of each column.
For example, i want to print in the window the following :
ID Title
1 lol
2 lala
the following code prints only
1 lol
2 lala
without the titles..
Code:
JFrame frame = new JFrame("Select Registration");
JPanel panel = new JPanel();
//String types[]= {"id", "title", "username","password","url","notes"};
String data[][] = { {"132","facebook"}};
// String col[] = {"Name","code"};
String types[] = {"id","title"};
/*
Vector types =new Vector() ;
types.add("id");
types.add("title");
types.add("username");
types.add("password");
types.add("url");
types.add("notes");
*/
DefaultTableModel model = new DefaultTableModel(data,types);
JTable table = new JTable(model);
panel.add(table);
frame.add(panel);
//frame.setSize(300, 300);
frame.setVisible(true);
frame.setResizable(true);
Please! need help!
thnx :)