This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Row Selection  RSS feed

 
Vishal Methi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have one simple problem in JTable . I want to select a row and for that i m using ListSelectionModel and seleting the SINGLEROWSELECTION but still its not working .. can u plz tell me the reason what it would be ..


Thanx and Regards
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much more information needed!

What have you tried?
What errors are you getting?
Where are you getting these errors (compiler or runtime)?
What does the relevant part of your code look like?

"still not working" is a rather broad term
 
Anand Karia
Ranch Hand
Posts: 156
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vishal

You have not clearly mentione what you wana do?

But as far as, if you want to get value from a single column in a table
then you can do the followings:

String strVal = jTable.getValueAt(jTable.getSelectedRow(),jTable.getSelectedColumn());
System.out.println(strVal);

Enjoy.
 
Anand Karia
Ranch Hand
Posts: 156
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh i forget the followings:

String strVal = String.valueOf(jTable.getValueAt(jTable.getSelectedRow(),jTable.getSelectedColumn()));
System.out.println(strVal);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!