Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Table Row slection programmatically  RSS feed

 
Deepshikha Lathiya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I want the first row of my table to be selected when it is initialized. There is a getSelectedRow() method, to fetch index of selected row.
There is no method like setSelectedRow(), which may perform the reverese operation. Is there any other way to do it?
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You already found the API, so if you do a more global search within JTable's API for "selection" or "selected" I'm sure you'll be able to find something
 
Deepshikha Lathiya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used "table.changeSelection(0, 0, true, false);" . And my problem is solved.

Thanks Rob.


 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have used setRowSelectionInterval(0, 0), but if it works it works
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!