below is my code.
how do i implement adding rows dynamically to the jtable using vector. ( i know it is vector.addElement something... But what is the actual code ? )

Thanks


import java.util.Vector;
import java.sql.*;
import OraDB;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
//import javax.swing.event.TableModelEvent;
import java.awt.*;
import java.awt.event.*;

public class demotable extends JPanel {
JPanel subpanel = new JPanel();
JLabel lbTitle = new JLabel("Registration Of Foreign Worker By Job Type and Sex");
JLabel lbTop = new JLabel("Statistics taken from 01/07/1999 to 31/07/1999 ");
JLabel lbLine = new JLabel("Fomema Info Centre Report Printed as of 31/10/1999");
Vector mdata = new Vector();

public demotable() {

String columns[] = {"Employee ID", "First Name",
"Last Name", "Department"};
String rows[][] = {
{"0181", "Bill", "Cat", "Political Candidate"},
{"0915", "Opus", "Penguin", "Lost and Found"},
{"9923", "Berke", "Breathed", "Editor"}
};

mdata.addElement
JTable table = new JTable (rows, columns);

table.getColumnModel().getColumn(1).setPreferredWidth(120);
table.getColumnModel().getColumn(1).setPreferredWidth(80);
table.setCellSelectionEnabled(false);
table.setRowSelectionAllowed(true);
table.setColumnSelectionAllowed(false);
table.getTableHeader().setReorderingAllowed(false);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
JScrollPane scrollPane = new JScrollPane(table);

subpanel.setLayout(new BoxLayout(subpanel,BoxLayout.Y_AXIS));
subpanel.add(lbTitle);
subpanel.add(Box.createVerticalStrut(5));
subpanel.add(lbTop);
subpanel.add(Box.createVerticalStrut(5));
subpanel.add(lbLine);
subpanel.add(Box.createVerticalStrut(5));

setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
add(subpanel);
add(scrollPane);

} // TableDemo ends here


public static void main(String[] args) {
JFrame f = new JFrame();
demotable tab = new demotable();
f.getContentPane().add(tab);

f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
f.pack();
f.setVisible(true);

} // main ends here

} // TableDemo ends here




http://members.xoom.com/lookads