我想知道StyledText实际显示了多少行。这可能吗?
感谢。
答案 0 :(得分:4)
试试这段代码:
// The index of the last (possibly only partially) visible line of the widget
int bottomIndex = JFaceTextUtil.getPartialBottomIndex((StyledText)widget);
// The index of the first (possibly only partially) visible line of the widget
int topIndex = JFaceTextUtil.getPartialTopIndex((StyledText)widget);
int visibleLines = bottomIndex - topIndex;