• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable rows focus highlighted

 
Ranch Hand
Posts: 1907
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi All,
I am creating small swing application.Main panel contains JTable.From Find Menu, user opens Dialog and types a word to be seached.After clicking on Find button in Dialog, only those rows should be highlighted which contain the word to be searched.How to do this?

Thanks
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to do what? You have multiple steps here and you haven't defined what step you are having a problem with. Do you know:

a) how to create a text field
b) how to get the text from the text field
c) how to create a table
c) search the TableModel one row at a time
d) use a ListSelectionModel to select a row

Or better yet do you know how to use a RowFilter so that the table will only display the rows with the selected text. Read the JTable API and follow the link to the Swing tutorial on "How to Use Tables" for a working example of filtering.
 
Arjun Shastry
Ranch Hand
Posts: 1907
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.Its step d, Searching the TableModel(hence dataVector) and highlighting those rows where word matches.I am using JDK 1.5.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic