Пример #1
0
 /**
  * Returns the top pixel.
  *
  * <p>The top pixel is the pixel position of the line that is currently at the top of the widget.
  * On some platforms, a text widget can be scrolled by pixels instead of lines so that a partial
  * line is displayed at the top of the widget.
  *
  * <p>The top pixel changes when the widget is scrolled. The top pixel does not include the widget
  * trimming.
  *
  * @return the pixel position of the top line
  * @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 getTopPixel() {
   checkWidget();
   if (variant == TextUtils.LINE_EDIT) {
     return 0;
   } else {
     return OS.QScrollBar_value(OS.QAbstractScrollArea_verticalScrollBar(scrollAreaHandle));
   }
 }
Пример #2
0
 /**
  * Sets the contents of the receiver to the given string. If the receiver has style SINGLE and the
  * argument contains multiple lines of text, the result of this operation is undefined and may
  * vary from platform to platform.
  *
  * @param string the new text
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_NULL_ARGUMENT - if the string is null
  *     </ul>
  *
  * @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 setText(String string) {
   checkWidget();
   TextUtils.setText(variant, topHandle, string, textLimit, this);
   if (isDisposed()) return;
   if (variant == TextUtils.TEXT_EDIT) {
     OS.QScrollBar_setValue(OS.QAbstractScrollArea_verticalScrollBar(scrollAreaHandle), 0);
   }
 }