我有一个JTable
显示日志文件的内容,第一列是一个以毫秒为单位的时间戳(例如 10:31:54.531)。数据已按此列排序。我想让用户滚动到他感兴趣的时间戳。
这是我想做的Java片段:
String myTimestamp = "10:31:54.531";
Integer myRowIndex = getRowIndexFromStringTimestamp(myTimestamp);
myJTable.getSelectionModel().setSelectionInterval(myRowIndex, myRowIndex);
myJTable.scrollRectToVisible(new Rectangle(myJTable.getCellRect(myRowIndex, 0, true)));
但如何实施getRowIndexFromStringTimestamp
?
谢谢