Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Forcing a cell selection in a JTable  RSS feed

Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to select a cell in a JTable programmtically. I have the SelectionModel for the rows and columns. When I use the following -

I don't see the selection occuring. I know it is though, as I have a class which implements ListSelectionListener and TableColumnModelListener to notify me of cell selections. This class updates values on the screen, based on the current selection in the table.
In essence, if I click in the table, I see the cell highlight and the screen changes, based on my selection. When I do the selection programmtically, the cell does not highlight, but the screen does update to reflect what should be selected.
Any thoughts?
Aaron R>
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me a single column is selected..
table.getSelectionModel().setSelectionInterval(row, row);
table.getColumnModel().getSelectionModel().setSelectionInterval(col, col);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!