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

Chapter 15. Layout > Class Layout

15.2. Class Layout

Class Layout is the abstract superclass of all layout classes. Because layout algorithms are so diverse, class Layout does not have any public API or fields. This may seem odd at first. One might at least expect to find public methods to invoke the algorithm. Instead, each individual Layout class provides public API that is appropriate for its particular algorithm. The class Layout provides protected API that layouts must implement in order to interact with controls.

15.2.1. Setting a Layout

Layouts are pluggable. That is, any layout algorithm can be associated with any composite. As we previously stated, in many native widget toolkits, this is not the case.[5] To associate a layout with a composite, the setLayout() method is used.

[5] For example, Motif provides a widget, XmRowColumn, which positions children in rows or columns. To create a group box with radio buttons on Motif, it is necessary to create two native controls, the XmFrame that implements the group box and an XmRowColumn to position the children within it. SWT does not have this limitation.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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