Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Record Number in JTable

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


Read this thread.


HTH,


Carlos.
 
Rod Sinclair
Greenhorn
Posts: 22
  • 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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
  • 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
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic