org.eclipse.swt.widgets.Text.getLineCount()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.eclipse.swt.widgets.Text.getLineCount()方法的一些代码示例,展示了Text.getLineCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.getLineCount()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Text
类名称:Text
方法名:getLineCount

Text.getLineCount介绍

[英]Returns the number of lines.
[中]返回行数。

代码示例

代码示例来源:origin: org.xworker/xworker_swt

public static int getLineCount(Object obj) {
    if(obj instanceof Text) {
      Text text = (Text) obj;
      return text.getLineCount();
    }else if(StyledTextProxy.isStyledText(obj)) {
      return StyledTextProxy.getLineCount(obj);			
    }else {
      return -1;
    }
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Sets the zero-relative index of the line which is currently
 * at the top of the receiver. This index can change when lines
 * are scrolled or new lines are added and removed.
 *
 * @param index the index of the top item
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setTopIndex (int index) {
  checkWidget ();
  if ((style & SWT.SINGLE) != 0) return;
  int row = Math.max(0, Math.min(index, getLineCount() - 1));
  NSPoint pt = new NSPoint();
  pt.x = scrollView.contentView().bounds().x;
  pt.y = getLineHeight() * row;
  view.scrollPoint(pt);
}

相关文章

Text类方法