• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Record Number in JTable

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 221
Scala Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rod,


Read this thread.


HTH,


Carlos.
 
Rod Sinclair
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic