aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Booking method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Booking method" Watch "Booking method" New topic
Author

Booking method

joey phillip
Ranch Hand

Joined: Jan 22, 2001
Posts: 40
How to get the recordNumber when the users selects specfic row in JTable?
I am trying to implement the book method in client side and in my AbstractTableModel class i am using Object [][].
joey
Matt DeLacey
Ranch Hand

Joined: Oct 12, 2000
Posts: 318
Try getSelectedRow() of class JTable.
With Respect,
Matt
joey phillip
Ranch Hand

Joined: Jan 22, 2001
Posts: 40
Hi Matt !
Thanks for your response

I am talking about DataInfo's recordNumber field(Unique key).

How do you get recorNumber for lock() and unlock()?
joey
[This message has been edited by joey phillip (edited March 27, 2001).]
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
You have to keep a hash table or something on the client to hold the record numbers
joey phillip
Ranch Hand

Joined: Jan 22, 2001
Posts: 40
Hi paul,

Can it be a Vector inside the MyTableModel class ?
read http://www.javaranch.com/ubb/Forum25/HTML/000552.html

Are you storing all db records in the hastable or only the
records which matches searchcriteria?

Thanks
joey
Matt DeLacey
Ranch Hand

Joined: Oct 12, 2000
Posts: 318
If you are keeping a vector or some such in your tablemodel, which seems like the way to go to me, then you don't need to explicitly also track the recordnum. You can access it through the DataInfo class. I don't know what you're storing in your Vector, but if you'll just store DataInfos, you can readily access the recordnum. That in conjunction with a getDataAt in your TableModel. Does that answer your question?
With Respect,
Matt
Matt DeLacey
Ranch Hand

Joined: Oct 12, 2000
Posts: 318
But you'll need to get an updated (i.e. from db.db) version using
the recordnum else the data might be stale.
joey phillip
Ranch Hand

Joined: Jan 22, 2001
Posts: 40
Hi Matt,
Yes. I am storing DataInfo objects in Vector. after every search the Vector will be updated with new data and will be populated in JTable.
Thanks
joey
luis veron
Ranch Hand

Joined: Mar 07, 2001
Posts: 35
hello,
I think what joey is trying to point here is when you format your table (tablemodel), were not going to include the record number (visible) in the table itself. Only the values, in this case the array of strings in Datainfo (String[] values).
I was kind of thinking on including the record number but it should only be in the background. as in invisible? So when you select a row, you only need to get the record number. Though, I haven't started implementing this idea. What do you think guys...
regards,
luis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Booking method