Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to with JTables?

 
Maurice Traun
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I need some help with something that I want to do.
I need that if I select one row in a Jtable, in other table next to the first, a row changes his background color.

For example.
In table 1 there's 3 rows [{1,John,London},{2,Peter,New York},{3, Paul, Oslo}]
In table 2 there's 4 rows [{1,Norway},{2,England},{3, Nicaragua},{4,USA}]

So, if i click in table 1, row 1. In the table 2 the second row must changes his background color. Now if I click now in row 3 (table 1), row 1 (table 2) must changes his background color.

I have tried with a ListSelectionListener, but I don't have how to recognize the rows in the table 2.

Sorry for my english, but isn't my mother language.

Regards.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to setup a mapping from cities (Oslo) to countries (Norway). You then take the city from the first table's row, lookup the country, and then loop through the second table to find that country.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!