Exemplo n.º 1
0
 /**
  * Sets the receiver's size to the point specified by the arguments.
  *
  * @param width the new width for the receiver
  * @param height the new height for the receiver
  * @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 setSize(int width, int height) {
   checkWidget();
   if (this.width == width && this.height == height) return;
   this.width = width;
   this.height = height;
   resize(width, height);
 }
Exemplo n.º 2
0
 /**
  * Sets the receiver's size and location to the rectangular area specified by the arguments. The
  * <code>x</code> and <code>y</code> arguments are relative to the receiver's parent (or its
  * display if its parent is null).
  *
  * @param x the new x coordinate for the receiver
  * @param y the new y coordinate for the receiver
  * @param width the new width for the receiver
  * @param height the new height for the receiver
  * @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 setBounds(int x, int y, int width, int height) {
   checkWidget();
   boolean samePosition = this.x == x && this.y == y;
   boolean sameExtent = this.width == width && this.height == height;
   if (samePosition && sameExtent) return;
   this.x = x;
   this.y = y;
   this.width = width;
   this.height = height;
   if (!sameExtent) resize(width, height);
   if (!samePosition) move(x, y);
 }
Exemplo n.º 3
0
 /**
  * Sets the image that the receiver will use to paint the caret to the image specified by the
  * argument, or to the default which is a filled rectangle if the argument is null
  *
  * @param image the new image (or null)
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the image has been disposed
  *     </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 setImage(Image image) {
   checkWidget();
   if (image != null && image.isDisposed()) {
     error(SWT.ERROR_INVALID_ARGUMENT);
   }
   this.image = image;
   if (image != null) {
     OS.Image_Source(imageHandle, image.handle);
     OS.UIElement_Visibility(imageHandle, OS.Visibility_Visible);
   } else {
     OS.Image_Source(imageHandle, 0);
     OS.UIElement_Visibility(imageHandle, OS.Visibility_Collapsed);
   }
   resize(width, height);
 }