File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Record Number in JTable

 
Rod Sinclair
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am doing the URLyBird assignment.

I will create a Room object that will contain the recNo. My table will then display the Room objects. I have read a thread that talks about the record number in the JTable but am still unsure. Just wondering do you have to create some sort of hidden column in the table containing the record number or is there an alternative approach.

Regards

Rod
 
Carlos Morillo
Ranch Hand
Posts: 221
Java Python Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rod,


Read this thread.


HTH,


Carlos.
 
Rod Sinclair
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carlos,

Thanks for the quick response and the link.

Looks like one way to do it then is to maintain a list of Room objects in the table model which are in the same order as the rooms are displayed in the table. Then the table index of the selected row in the table will allow me to create the Room object from the appropriate list element.

Regards

Rod
 
Roel De Nijs
Sheriff
Posts: 9091
73
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rod,

You don't have to create a Room object when a user selects a row from the table. You just retrieve the Room object from the list in the table model.

Kind regards,
Roel
 
Rod Sinclair
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roel,

ok. I'm with you now. I'll just grab the Room object from the list.

Many thanks

Rod
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic