i would like to retrieve data from database and insert it into jtable on netbeans...how to use the jtable.
Printable View
i would like to retrieve data from database and insert it into jtable on netbeans...how to use the jtable.
Please have a look at the source: How to use Tables
I have found it's answer that i can use the method setValue of table class ie.
table1.setValue(vector.elementsAt(1),0,1);
but i am not able to create new row dynamically ...does anyone know that how can we create dynamic row in netbeans?:D:
The link you have given is basic tutorial of java swing..i know how to insert a row into a table without using Netbeans IDE...but my entire project is being done on netbeans...And i am not that much familiar to netbeans as it has it's own way for coding...so please give any links which holds the tutorial of jtable on netbeans IDE...thanks for your helping hands..
It's the same. You get the table model and you add a row to it whether it is done with NetBeans or not.
You need to use the DefaultTableModel. It supports addRow(...) functionality.
see...my table name is jTable1;
jTable1.getModel().
The above code is working..but ..i am not able to find any insertRow or AddRow method on the pop menu after the dot of above statement...
You need to cast the TableModel to a DefaultTableModel.
how to use it?
did you mean below code?
((DefaultTableModel)jTable1.getModel()).addRow(amo unt,0,1);
but it's not working...i can see an red underline below the (DefaultTableModel)
yes...now it is working...
import javax.swing.Table.DefaultTableModel;
thanks for all those helped me to fix the error..t