Add Row on JTable

Hallo All,I have problem about Add or Remove Row on JTable.How to Add Row On JTabel.for example i have two Row and i want to Add one Row. the Display like Purchase Order.thanks
[211 byte] By [panji_tengkoraka] at [2007-10-3 4:26:07]
# 1
In order to add a row you have to use TableModel.try looking into http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
asrfela at 2007-7-14 22:28:45 > top of Java-index,Desktop,Core GUI APIs...
# 2
The DefaultTableModel supports add/remove row functionality.
camickra at 2007-7-14 22:28:45 > top of Java-index,Desktop,Core GUI APIs...
# 3

I Have Code like this :

package src;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTabbedPane;

import javax.swing.JTable;

public class TestTabel extends JFrame{

/**

* by Yusuf Hermanto

*/

JPanel pnl = new JPanel();

JButton jbaddRow= new JButton("+");

JButton jbdelRow= new JButton("-");

JTable tbl;

String tblHeader[] =

{"No.","Code","Descripion","Price","Qty.","Disc","Amount"

};

String tblData[][]={{"","","","","","",""}};

public TestTabel()

{

super("Purchase Order");

tbl = new JTable(tblData,tblHeader);

pnl.add(new JScrollPane(tbl));

pnl.add(jbaddRow);

pnl.add(jbdelRow);

getContentPane().add(pnl);

setSize(400,500);

}

ActionListener actBtn = new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

if(e.getSource().equals(jbaddRow))

{

addRow();

}

else if(e.getSource().equals(jbdelRow))

{

delRow();

}

}

};

void addRow()

{

}

void delRow()

{

}

}

and i do'nt know the code must i enter on function addRow() ad delRow().

can anybody halp me ?

panji_tengkoraka at 2007-7-14 22:28:45 > top of Java-index,Desktop,Core GUI APIs...
# 4
It's been suggested twice now that you use a TableModel.If you look at the API docs for TableModel you'll see a link called "Creating a TableModel."
itchyscratchya at 2007-7-14 22:28:45 > top of Java-index,Desktop,Core GUI APIs...