Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2005

Tip: Looking for answers? Try searching our database.

Replace row in JTable

Thread view: 
Brian - 28 Apr 2005 20:58 GMT
Hey,

Is it possiable to replace a row in a JTable with another on? I update a row
from the JTable, and want the new data to replace the old ones.

Brian
John McGrath - 28 Apr 2005 22:28 GMT
> Is it possiable to replace a row in a JTable with another on? I update a
> row from the JTable, and want the new data to replace the old ones.

Yes, if your TableModel supports it.  Take a look at DefaultTableModel.

Signature

Regards,

John McGrath

Brian - 28 Apr 2005 23:27 GMT
Hello,

I use the DefaultTableModel, and I have found the method
setValueAt(object,int,int) - nut isn't there anything smartere you can do?

Brian
Ivan - 29 Apr 2005 01:33 GMT
Set the table values and then call
public void fireTableRowsUpdated(int firstRow, int lastRow) inherited from
AbstractTableModel

Ivan

> Hello,
>
> I use the DefaultTableModel, and I have found the method
> setValueAt(object,int,int) - nut isn't there anything smartere you can do?
>
> Brian
John McGrath - 29 Apr 2005 06:30 GMT
> I use the DefaultTableModel, and I have found the method
> setValueAt(object,int,int) - nut isn't there anything smartere you can
> do?

If you are not happy with the methods that DefaultTableModel provides,
then subclass it and add any methods that you want.  Just make sure you
fire the appropriate events when you modify the model.

Signature

Regards,

John McGrath



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.