|
|
< Day Day Up > |
|
Chapter 15. LayoutA layout is an instance of a class that implements a positioning and sizing algorithm. Layouts are used to arrange controls within a composite automatically. Class Layout is not a subclass of class Widget, so it shares none of the Widget behavior. There is no operating system storage associated with a layout; thus, instances do not need to be sent the dispose() message when you are finished with them. Layout offers several distinct advantages over explicitly positioning and sizing controls. Some of these are:
Nevertheless, use of layouts is not mandatory. For example, on a platform such as a personal digital assistant where the screen and font size might not change, the size and position of controls may be known in advance. In this case, it is potentially simpler to position controls explicitly at pixel positions using setBounds(), setSize(), or setLocation(). Many operating systems provide rudimentary layout capabilities.[1] Unfortunately, most operating system layout algorithms are implemented as widgets and cannot be separated from the widget that they affect. In addition, native layout algorithms are quite diverse and make use of many platform-specific features in their implementation. Because native layouts have few common features and emulating their particular quirks on the other platforms would be difficult, layouts in SWT are not implemented using the platform mechanisms. Instead, a package of standard layouts has been created that provide a wide range of capabilities from simple space filling to very powerful and general forms. These layouts do not have platform-specific implementations. They can be found in the package org.eclipse.swt.layout.
|
|
|
< Day Day Up > |
|