• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Control Fundamentals > Moving and Resizing

4.3. Moving and Resizing

Controls are moved or resized by changing their bounds. SWT provides the following methods to set the bounds of a control.

setBounds(int x, int y, int width, int height) Sets the location and size of the control. The x and y coordinates are relative to the parent. If the width or height parameters are negative, zero is used instead.

setBounds(Rectangle bounds) Sets the location and size of the control. Equivalent to setBounds(bounds.x, bounds.y, bounds.width, bounds.height).

setLocation(int x, int y) Sets the location of the control. The x and y coordinates are relative to the parent.

setLocation(Point location) Sets the location of the control. Equivalent to setLocation(location.x, location.y).

setSize(int width, int height) Sets the size of the control. If the width or height parameters are negative, zero is used instead.

setSize(Point size) Sets the size of the control. Equivalent to setSize(size.x, size.y).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint