当我运行以下代码时:
if(e.getSource()== searchJobTypeBtn)
{
String value = searchJobTypeTxt.getText();
for (int row = 0; row <= jobTable.getRowCount() - 1; row++)
{
for (int col = 0; col <= jobTable.getColumnCount() - 1; col++)
{
if (value.equals(jobTable.getValueAt(row, col)))
{
// this will automatically set the view of the scroll in the
location of the value
jobTable.scrollRectToVisible(jobTable.getCellRect(row, 0,
true));
// this will automatically set the focus of the
searched/selected row/value
jobTable.setRowSelectionInterval(row, row);
for (int i = 0; i <= jobTable.getColumnCount() - 1; i++)
{
jobTable.getColumnModel().getColumn(i).setCellRenderer(new
HighlightRenderer());
System.out.println("job type found: " +i);
}
}
}
}`
高亮显示适当的行,但一次仅高亮显示一小会儿。我想知道是否有一种方法可以使所有适当的行都保持突出显示状态,或者在每行之间至少可以有一些时间被突出显示?另外,我如何通知用户未找到其搜索值?