Is there anyway I can highlight a row in JTable?

后端 未结 3 1927
野性不改
野性不改 2021-01-15 15:12

I am currently building a database using JTable and DefaultTableModel. In my program I have a function which allows users to search the database. I have the search part buil

3条回答
  •  旧巷少年郎
    2021-01-15 15:42

    The Swing tutorial on How to Use Tables has a section on filtering so you can just dislay the data that meet the search criteria. If you want to see all the data, then you just remove the filter.

    If you really want to do separate highlighting then I would take a look at the Table Row Rendering approach.

提交回复
热议问题