JTable change cell background at mouse click - after release change background back?

前端 未结 3 1679
孤城傲影
孤城傲影 2021-01-06 21:30

my question is, how to solve following problem:

If i click on a cell in a JTable, i want to change its background. If i release the mousebutton, i want the backgroun

3条回答
  •  遥遥无期
    2021-01-06 22:18

    Yes it is possible. Use a custom ListSelectionModel and set your JTable to use that : setSelectionModel().

    Here's an example.

提交回复
热议问题