This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - how to programmically select a row  RSS feed

 
zoe goddard
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table that I want to programmically select a single row (the first one) How would I do that? I tried table.setSelectedRow(0) but it wasn't recognized. Does anyone know how I can do this?
Thanks in advance.
 
Jigar Gosar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am copying the below lines for you from java api documentation hope it helps you let me know

setRowSelectionInterval
public void setRowSelectionInterval(int index0,
int index1)
Selects the rows from index0 to index1, inclusive.
Parameters:
index0 - one end of the interval
index1 - the other end of the interval
Throws:
IllegalArgumentException - if index0 or index1 lie outside [0, getRowCount()-1]
 
zoe goddard
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks like what I want. When I was looking through the documentation I must have missed it. I'll give it a try.
Thanks! :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!