FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to Insert record at top row of table

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
blackpearlmoni



Joined: 05 Nov 2009
Posts: 2

PostPosted: Thu Nov 05, 2009 10:45 am    Post subject: How to Insert record at top row of table Reply with quote

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
View user's profile Send private message
nicephotog



Joined: 07 Nov 2009
Posts: 7
Location: Australia

PostPosted: Sat Nov 07, 2009 3:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB