JTable ..所选行的颜色
问题描述:
我有一个Java的JTable,其中有一个自定义的dataMOdel和自定义的渲染器.现在,当我选择某个单元格时,它周围有一个深蓝色边框.我希望所选行全部以某种颜色突出显示.该怎么做?
I have a JTable in Java that has a custom dataMOdel and custom renderer. Now when i select some cell it has a dark blue border around it. I want the selected row to be all highlighted in some colour. How to do that?
答
您必须使用自定义表格单元格渲染器.在此处查看该教程: http://java.sun. com/docs/books/tutorial/uiswing/components/table.html#renderer
You have to use custom table cell renderer. Check out the tutorial here: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer