• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need code to filter(search for text in a row) for JTable

 
Nicolay Xomkovich
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Fred Kleinschmidt
Bartender
Posts: 460
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To search for some particular text in a table row, use Object obj = model.getValueAt(row, column) in a loop over all columns, and check whether obj matches the text you are looking for.
 
Nicolay Xomkovich
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Kleinschmidt wrote:To search for some particular text in a table row, use Object obj = model.getValueAt(row, column) in a loop over all columns, and check whether obj matches the text you are looking for.


Sorry, I'm a beginner in Java , you could not write the code for my the JTable , so that I could understand . Thank you.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Please have a look in the Java™ Tutorials, which I think will help you.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Please have a look in the Java™ Tutorials, which I think will help you.


In particular "Sorting and Filtering" is what you're asking about -- although going through the other parts of the tutorial would be very likely to prevent you from floundering around with code written using guesswork.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!