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 ?