java高亮显示矩形对象
Possible Duplicate:
Find the JTable cell and paint it
这是我的矩形类对象
Rectangle cell = table.getCellRect(row, column, false);
现在我想在鼠标按下事件中突出显示它,然后再次回到正常的鼠标释放事件
你可以在下面搜索框中键入要查询的问题!
Possible Duplicate:
Find the JTable cell and paint it
这是我的矩形类对象
Rectangle cell = table.getCellRect(row, column, false);
现在我想在鼠标按下事件中突出显示它,然后再次回到正常的鼠标释放事件
# 1 楼答案
有多种方法可以添加该功能
第一个是为单元实现自定义渲染器/编辑器。渲染器保持行/列和isPressed状态。当按下鼠标时,将设置渲染器状态,并在释放时重置
另一种方法是重写
JTable's
paintComponent()方法,以使用半透明颜色绘制Rectangle