Thanks!!!!
For solving this problem I have written a little Java applet:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class AddRow extends JApplet
{
JButton button;
Container c;
// define a model which the table has to communicate with
DefaultTableModel dtm = new DefaultTableModel();
// define a table
JTable t;
// create as much objects as there are columns. There are four columns
(Name, Address, Zip Code and Place
Object rowData[] = new Object[4];
public void init()
{
// query the content pane
c = getContentPane();
// declare a table based on the Default Table Model
t = new JTable(dtm);
// place the table in the scroll pane and put the scroll pane in the
content pane of the applet
c.add(new JScrollPane(t));
// adding columns into the model whose effect is immediately visible
in the table
dtm.addColumn("Name");
dtm.addColumn("Address");
dtm.addColumn("Zip Code");
dtm.addColumn("Place");
// now I want to add rows (c.q. records) to my table
// adding my own address
rowData[0] = "Hans Kamp";
rowData[1] = "Wilhelminastraat 60";
rowData[2] = "7511 DP";
rowData[3] = "Enschede";
dtm.addRow(rowData);
// adding my father's address. I hope he won't mind me doing so :-)
rowData[0] = "Johan Kamp";
rowData[1] = "Katoenstraat 3";
rowData[2] = "7621 TC";
rowData[3] = "Borne";
dtm.addRow(rowData);
}
}
Good luck!
--
Hans Kamp (Win2000)
in...@hanskamp.com
www.hanskamp.com
ICQ=65694322
Regards,
Sidney
Hans Kamp <hmk...@home.nl> wrote in message
news:mDdg5.4214$dr.1...@news1.zwoll1.ov.nl.home.com...