| View previous topic :: View next topic |
| Author |
Message |
blackpearlmoni
Joined: 05 Nov 2009 Posts: 2
|
Posted: Thu Nov 05, 2009 10:45 am Post subject: How to Insert record at top row of table |
|
|
| hello..m new to netbeans ide 6.5...i have binded jtable component to my database table n even able to insert the value thru action event on a button...but the value is inserted at the end of table while i require the latest value at the top of the table...m unable to find any specific javadoc related to this..?!! can this be achieved by changing any property of the jtable??? |
|
| Back to top |
|
 |
nicephotog
Joined: 07 Nov 2009 Posts: 7 Location: Australia
|
Posted: Sat Nov 07, 2009 3:13 pm Post subject: |
|
|
change the way you manage the TableModel and make a method
to obtain the row information then change the model by re-initiating it with the new data for size and position of data(in the model), then call setModel on it.
generally though things like that have a
| Code: | defaultMod.insertRow(0,OBJECT-ARRAY);
//defaultMod.addRow(OBJECT-ARRAY);
jtable.setModel(defaultMod); |
javax.swing.table.DefaultTableModel IMPLEMENTS interface TableModel
From what i can see of the constructor,
either the Vector list, or the Object[] array appears the best for
that management of dynamic data change.
then jtable.repaint() if required. _________________ Did you have the fish?..........................No. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|