Esempio n. 1
0
 /**
  * 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>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void setTopIndex(int index) {
   checkWidget();
   if (variant == TextUtils.TEXT_EDIT) {
     index = Math.min(Math.max(index, 0), OS.QTextEdit_swt_getLineCount(topHandle) - 1);
     OS.QTextEdit_swt_setTopIndex(topHandle, index);
   }
 }
Esempio n. 2
0
 /**
  * Returns the number of lines.
  *
  * @return the number of lines in the widget
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public int getLineCount() {
   checkWidget();
   if (variant == TextUtils.LINE_EDIT) {
     return 1;
   } else {
     forceTextLayout();
     return OS.QTextEdit_swt_getLineCount(topHandle);
   }
 }