/** * Returns a point describing the receiver's size. * * @return the receiver's size * @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 Point getSize() { checkWidget(); if (image != null) { Rectangle rect = image.getBounds(); return new Point(rect.width, rect.height); } return new Point(width, height); }
/** * Returns a rectangle describing the receiver's size and location relative to its parent (or its * display if its parent is null). * * @return the receiver's bounding rectangle * @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 Rectangle getBounds() { checkWidget(); if (image != null) { Rectangle rect = image.getBounds(); return new Rectangle(x, y, rect.width, rect.height); } return new Rectangle(x, y, width, height); }
void resize(int width, int height) { if (image != null) { Rectangle rect = image.getBounds(); width = rect.width; height = rect.height; } if (width == 0) width = 1; OS.FrameworkElement_Width(handle, width); OS.FrameworkElement_Height(handle, height); }