• 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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);
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!