• Post Reply Bookmark Topic Watch Topic
  • New Topic

Joined tables and JCombobox

 
Luca Rossi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 table:
CARS
-cars.id (int)
-cars.make (int)
-cars.model (string)

and

BRAND
-brand.id
-brand.name

The two are joined with a foreign key (cars.make > brand.id). Once I generate the enitites for the two, I can then bind the first to a JTable and show the brand.name instead of cars.make in a JComboBox. The problem is that if I change the value in the JComboBox, it is not reflected in the table. How can I have it return the cars.make int to the table cell?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Luca Rossi:
How can I have it return the cars.make int to the table cell?


The table pulls data from a table model. The getValueAt(int row,int column) method returns the Object for each cell.
You need to tweak this method to return whatever Object you want to display.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!