blob: b9fecadad3bed9062fee14dbde8047e7041f2d7c [file] [log] [blame]
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./Understanding%20Layouts_files/filelist.xml">
<link rel=OLE-Object-Data href="./Understanding%20Layouts_files/oledata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Understanding Layouts in SWT</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>OTI EMPLOYEE</o:Author>
<o:LastAuthor>Dave Thomson</o:LastAuthor>
<o:Revision>19</o:Revision>
<o:TotalTime>4133</o:TotalTime>
<o:LastPrinted>2001-03-07T20:56:00Z</o:LastPrinted>
<o:Created>2001-06-04T02:06:00Z</o:Created>
<o:LastSaved>2001-06-04T16:29:00Z</o:LastSaved>
<o:Pages>27</o:Pages>
<o:Words>5576</o:Words>
<o:Characters>31787</o:Characters>
<o:Company>OBJECT TECHNOLOGY INTL</o:Company>
<o:Lines>264</o:Lines>
<o:Paragraphs>63</o:Paragraphs>
<o:CharactersWithSpaces>39036</o:CharactersWithSpaces>
<o:Version>9.2720</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:ActiveWritingStyle Lang="EN-US" VendorID="8" DLLVersion="513" NLCheck="0">1</w:ActiveWritingStyle>
<w:DoNotHyphenateCaps/>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>0</w:DisplayVerticalDrawingGridEvery>
<w:UseMarginsForDrawingGridOrigin/>
<w:Compatibility>
<w:UsePrinterMetrics/>
<w:WW6BorderRules/>
<w:FootnoteLayoutLikeWW8/>
<w:ShapeLayoutLikeWW8/>
<w:AlignTablesRowByRow/>
<w:ForgetLastTabAlignment/>
<w:LayoutRawTableWidth/>
<w:LayoutTableRowsApart/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<link rel=Stylesheet type="text/css" media=all
href="Understanding%20Layouts_files\default_style.css">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
h1
{mso-style-next:Normal;
margin-top:12.0pt;
margin-right:0in;
margin-bottom:3.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:1;
font-size:21.0pt;
font-family:Arial;
color:windowtext;
mso-font-kerning:14.0pt;
font-weight:bold;}
h2
{mso-style-next:Normal;
margin-top:12.0pt;
margin-right:0in;
margin-bottom:6.0pt;
margin-left:0in;
mso-line-height-alt:10.5pt;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:2;
font-size:18.0pt;
font-family:Arial;
color:windowtext;
font-weight:bold;}
h3
{mso-style-next:Normal;
margin-top:12.0pt;
margin-right:0in;
margin-bottom:3.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:3;
font-size:14.0pt;
font-family:Arial;
color:windowtext;
font-weight:bold;}
h4
{mso-style-next:Normal;
margin-top:12.0pt;
margin-right:0in;
margin-bottom:3.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:4;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
color:windowtext;
font-weight:bold;
mso-bidi-font-weight:normal;}
h5
{mso-style-next:Normal;
margin:0in;
margin-bottom:.0001pt;
text-align:center;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:5;
mso-list:skip;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
color:windowtext;
font-weight:bold;
mso-bidi-font-weight:normal;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{mso-style-next:Normal;
margin-top:.25in;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;
text-transform:uppercase;
font-weight:bold;
mso-bidi-font-weight:normal;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{mso-style-next:Normal;
margin-top:12.0pt;
margin-right:0in;
margin-bottom:0in;
margin-left:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;
font-weight:bold;
mso-bidi-font-weight:normal;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:10.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc4, li.MsoToc4, div.MsoToc4
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:20.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc5, li.MsoToc5, div.MsoToc5
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:30.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc6, li.MsoToc6, div.MsoToc6
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:40.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc7, li.MsoToc7, div.MsoToc7
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:50.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc8, li.MsoToc8, div.MsoToc8
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:60.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoToc9, li.MsoToc9, div.MsoToc9
{mso-style-next:Normal;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:70.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:windowtext;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:red;}
p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:.25in .5in .75in 1.0in 1.25in 1.5in;
layout-grid-mode:char;
font-size:9.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
strong
{mso-bidi-font-weight:normal;}
em
{mso-bidi-font-style:normal;}
p
{margin-top:5.0pt;
margin-right:0in;
margin-bottom:5.0pt;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";
color:black;}
code
{mso-ansi-font-size:8.5pt;
mso-bidi-font-size:8.5pt;
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";}
pre
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Courier New";
color:windowtext;}
p.Code, li.Code, div.Code
{mso-style-name:Code;
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:.25in .5in .75in 1.0in 1.25in 1.5in 1.75in 2.0in 2.25in 2.5in 2.75in 3.0in 3.25in 3.5in 3.75in 4.0in 4.25in 4.5in 4.75in 5.0in 5.25in 5.5in 5.75in;
layout-grid-mode:char;
font-size:9.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-title-page:yes;
mso-even-footer:url("./Understanding%20Layouts_files/header.htm") ef1;
mso-footer:url("./Understanding%20Layouts_files/header.htm") f1;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:-2;
mso-list-type:simple;
mso-list-template-ids:-1;}
@list l0:level1
{mso-level-start-at:0;
mso-level-text:*;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:0in;
text-indent:0in;}
@list l1
{mso-list-id:346905124;
mso-list-type:hybrid;
mso-list-template-ids:-640262218 1992605384 -1164151212 196216344 207768582 -465804808 -978527370 -445462926 -1247488604 2084046000;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l2
{mso-list-id:400176146;
mso-list-type:hybrid;
mso-list-template-ids:-1883319026 -1449079578 1246159260 -1325105612 57442112 507803072 -1579807020 720565274 476881622 -2006260142;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.75in;
mso-level-number-position:left;
margin-left:.75in;
text-indent:-.25in;
font-family:Symbol;}
@list l3
{mso-list-id:605164106;
mso-list-type:hybrid;
mso-list-template-ids:832965996 1120049284 -1716494676 1491470454 296799966 -1824480168 1890771820 895397522 -1654206448 1985668936;}
@list l3:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.75in;
mso-level-number-position:left;
margin-left:.75in;
text-indent:-.25in;
font-family:Symbol;}
@list l4
{mso-list-id:1030568495;
mso-list-type:hybrid;
mso-list-template-ids:-170775920 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l4:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:26.65pt;
mso-level-number-position:left;
margin-left:26.65pt;
text-indent:-.25in;
font-family:Symbol;}
@list l5
{mso-list-id:1666586583;
mso-list-type:hybrid;
mso-list-template-ids:-170775920 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l5:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:26.65pt;
mso-level-number-position:left;
margin-left:26.65pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level1 lfo2
{mso-level-number-format:bullet;
mso-level-numbering:continue;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
mso-level-legacy:yes;
mso-level-legacy-indent:.25in;
mso-level-legacy-space:0in;
margin-left:.25in;
text-indent:-.25in;
font-family:Symbol;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1102"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal align=right style='margin-top:14.2pt;margin-right:0in;
margin-bottom:0in;margin-left:17.0pt;margin-bottom:.0001pt;text-align:right'><a
name="_Toc496069418"></a><a name="_Toc509864523"><span style='mso-bookmark:
_Toc496069418'><span style='font-size:8.0pt;mso-bidi-font-size:10.0pt'>Copyright
© 2001 Object Technology International, Inc.<o:p></o:p></span></span></a></p>
<table border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;
mso-cellspacing:0in;margin-left:17.0pt;mso-padding-alt:1.5pt 1.5pt 1.5pt 1.5pt'>
<tr>
<td valign=top style='background:#0080C0;padding:1.5pt 1.5pt 1.5pt 1.5pt'>
<p class=MsoNormal><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><b><span style='font-family:Arial;
color:white'>&nbsp;Eclipse Corner Article</span></b></span></span><span
style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'><span
style='mso-bidi-font-size:12.0pt'><o:p></o:p></span></span></span></p>
</td>
<span style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'></span></span>
</tr>
</table>
<h1 style='margin-left:17.0pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><img width=120 height=86 id="_x0000_i1060"
src="../images/Idea.jpg" align=CENTER></span></span><span
style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'><span
style='font-size:8.0pt;mso-bidi-font-size:10.0pt'><o:p></o:p></span></span></span></h1>
<h1 align=center style='margin-left:17.0pt;text-align:center'><span
style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'>Understanding
Layouts in SWT</span></span></h1>
<p class=MsoNormal style='margin-left:17.0pt;text-indent:.5in'><span
style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'><b><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></span></span></p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:53.0pt;margin-bottom:.0001pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><b>Summary</b> <br>
When writing applications in SWT, you may need to use <i style='mso-bidi-font-style:
normal'>layouts</i> to give your windows a specific look. A layout controls the
position and size of children in a <i style='mso-bidi-font-style:normal'>Composite</i>.
Layout classes are subclasses of the abstract class <i style='mso-bidi-font-style:
normal'>Layout</i>. This article shows you how to work with standard layouts,
and write your own custom layout class.</span></span><span style='mso-bookmark:
_Toc509864523'><span style='mso-bookmark:_Toc496069418'><span lang=EN-CA
style='mso-bidi-font-size:12.0pt;mso-ansi-language:EN-CA'><o:p></o:p></span></span></span></p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:53.0pt;margin-bottom:.0001pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><b><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></span></span></p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:53.0pt;margin-bottom:.0001pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><b>By Carolyn MacLeod, OTI<o:p></o:p></b></span></span></p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:53.0pt;margin-bottom:.0001pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><span style='font-size:10.0pt'>March 22,
2001<o:p></o:p></span></span></span></p>
<p class=MsoNormal style='margin-top:0in;margin-right:.5in;margin-bottom:0in;
margin-left:53.0pt;margin-bottom:.0001pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'><b><span style='font-size:8.0pt;mso-bidi-font-size:
10.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></b></span></span></p>
<div class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><span
style='mso-bookmark:_Toc509864523'><span style='mso-bookmark:_Toc496069418'>
<hr size=2 width="100%" align=center>
</span></span></div>
<b style='mso-bidi-font-weight:normal'><span style='font-size:21.0pt;
font-family:Arial;mso-fareast-font-family:"Times New Roman";mso-font-kerning:
14.0pt;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA'><br clear=all style='page-break-before:always'>
</span></b>
<h1 style='margin-left:17.0pt'><span style='mso-bookmark:_Toc509864523'><span
style='mso-bookmark:_Toc496069418'>Layouts</span></span></h1>
<h2 style='margin-left:17.0pt'><a name="_Toc496069419"></a><a
name="_Toc496069776"></a><a name="_Toc509864524"><span style='mso-bookmark:
_Toc496069776'><span style='mso-bookmark:_Toc496069419'>Overview</span></span></a></h2>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>When writing
applications in SWT, you may need to use <i style='mso-bidi-font-style:normal'>layouts</i>
to give your windows a specific look. A layout controls the position and size
of children in a <i style='mso-bidi-font-style:normal'>Composite</i>. Layout
classes are subclasses of the abstract class <i style='mso-bidi-font-style:
normal'>Layout</i>. SWT provides several standard layout classes, and you can
write custom layout classes.</p>
<p class=MsoHeader style='margin-left:17.0pt;tab-stops:.5in center 3.0in right 6.0in'><a
name="_Toc496069420"></a><a name="_Toc496069777"><span style='mso-bookmark:
_Toc496069420'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></a></p>
<p class=MsoNormal style='margin-left:17.0pt'><span style='mso-bookmark:_Toc496069777'><span
style='mso-bookmark:_Toc496069420'>In SWT, positioning and sizing does not
happen automatically. Applications can decide to size and place a <i
style='mso-bidi-font-style:normal'>Composite</i>’s children initially or in a
resize listener – or they can specify a layout class to position and size the
children. If children are not given a size, they will have zero size and they
cannot be seen.</span></span></p>
<p class=MsoNormal style='margin-left:17.0pt'><span style='mso-bookmark:_Toc496069777'><span
style='mso-bookmark:_Toc496069420'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
<p class=MsoNormal style='margin-left:17.0pt'><span style='mso-bookmark:_Toc496069777'><span
style='mso-bookmark:_Toc496069420'>The diagram below illustrates a few general
terms that are used when discussing layouts. The <i>Composite</i> (in this
case, a <i>TabFolder</i>) has a <b>location</b>, <b>clientArea</b> and <b>trim</b>.
The size of the <i>Composite</i> is the size of the <b>clientArea</b> plus the
size of the <b>trim</b>. The <i>Composite</i> has two children that are laid
out side by side. A <i>Layout</i> is managing the size and position of the
children. This <i>Layout</i> allows <b>spacing</b> between the children, and a <b>margin</b>
between the children and the edges of the <i>Layout</i>. The size of the <i>Layout</i>
is the same as the size of the <i>Composite</i>’s <b>clientArea</b>.</span></span></p>
<p class=MsoNormal style='margin-left:17.0pt'><span style='mso-bookmark:_Toc496069777'><span
style='mso-bookmark:_Toc496069420'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></span></p>
<p class=MsoNormal style='margin-left:17.0pt'><!--[if gte vml 1]><o:wrapblock><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_s1067" type="#_x0000_t75" style='position:absolute;
left:0;text-align:left;margin-left:0;margin-top:0;width:390pt;height:222pt;
z-index:6'>
<v:imagedata src="./files/image001.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![if gte mso 9]><o:OLEObject Type="Embed" ProgID="PBrush"
ShapeID="_x0000_s1067" DrawAspect="Content" ObjectID="_1053162908">
</o:OLEObject>
<![endif]><![endif]--><![if !vml]><img width=520 height=296
src="./files/image002.jpg" v:shapes="_x0000_s1067"><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<span style='mso-bookmark:_Toc496069777'><span style='mso-bookmark:_Toc496069420'>The
<i>preferred size</i> of a widget is the minimum size needed to show its
content. In the case of a <i>Composite</i>, the preferred size is the smallest
rectangle that contains all of its children. If children have been positioned
by the application, the <i style='mso-bidi-font-style:normal'>Composite</i>
computes its own preferred size based on the size and position of the children.
If a <i style='mso-bidi-font-style:normal'>Composite</i> is using a layout
class to position its children, it asks the <i style='mso-bidi-font-style:normal'>Layout</i>
to compute the size of its <b>clientArea</b>, and then it adds in the <b>trim</b>
to determine its preferred size.</span></span></p>
<span style='font-size:18.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h2 style='margin-left:17.0pt;mso-list:skip'><span style='mso-bookmark:_Toc496069777'><span
style='mso-bookmark:_Toc496069420'><a name="_Toc509864525">Standard Layouts</a></span></span></h2>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>The standard layout
classes in the SWT library are:</p>
<p class=MsoNormal style='margin-left:35.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><i style='mso-bidi-font-style:normal'>FillLayout</i> –
lays out equal-sized widgets in a single row or column</p>
<p class=MsoNormal style='margin-left:35.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><i style='mso-bidi-font-style:normal'>RowLayout</i> –
lays out widgets in a row or rows, with fill, wrap, and spacing options</p>
<p class=MsoNormal style='margin-left:35.0pt;text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><i style='mso-bidi-font-style:normal'>GridLayout</i> –
lays out widgets in a grid</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>To use the standard
layouts, you need to import the SWT layout package:</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'><span
style='mso-tab-count:1'>    </span>import</span> org.eclipse.swt.layout.*;</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>Layouts are
pluggable. To set a layout into a <i style='mso-bidi-font-style:normal'>Composite</i>
widget, you use the widget’s <b style='mso-bidi-font-weight:normal'>setLayout(Layout)</b>
method. In the following code, a <i style='mso-bidi-font-style:normal'>Shell </i>(a
subclass of<i style='mso-bidi-font-style:normal'> Composite</i>) is told to
position its children using a <i style='mso-bidi-font-style:normal'>RowLayout</i>:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>Shell
shell = <span style='color:navy'>new</span> Shell();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>shell.setLayout(<span
style='color:navy'>new</span> RowLayout());</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>A layout class may
have a corresponding layout data class – a subclass of <i style='mso-bidi-font-style:
normal'>Object</i> that contains layout data for a specific child. By
convention, layout data classes are identified by substituting <i
style='mso-bidi-font-style:normal'>Data</i> for <i style='mso-bidi-font-style:
normal'>Layout</i> in the class name. For example, the standard layout class <i
style='mso-bidi-font-style:normal'>RowLayout</i> has a layout data class called
<i style='mso-bidi-font-style:normal'>RowData</i>, and the layout class <i
style='mso-bidi-font-style:normal'>GridLayout</i> uses a layout data class
called <i style='mso-bidi-font-style:normal'>GridData</i>. Layout data classes
are set into a widget as follows:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>Button
button = <span style='color:navy'>new</span> Button(shell, SWT.PUSH);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>button.setLayoutData(<span
style='color:navy'>new</span> RowData(50, 40));</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<span style='font-size:18.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h2 style='margin-left:17.0pt'><a name="_Toc509864526">Examples in this
Document</a></h2>
<p class=MsoNormal style='margin-left:17.0pt'>Most of the snapshots in this
document were taken by running variations on the following example code. We may
change the type of layout, the options used, or the type or number of children.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.*;</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.widgets.*;</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.layout.*;</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>public</span>
<span style='color:navy'>class</span> LayoutExample {</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span><span
style='color:navy'>public</span> <span style='color:navy'>static</span> <span
style='color:navy'>void</span> main(String[] args) {</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Display
display = <span style='color:navy'>new</span> Display();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Shell
shell = <span style='color:navy'>new</span> Shell(display);</p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:maroon'>//
Create the layout.</span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>RowLayout layout = </span><span
style='color:navy'>new</span><span style='color:black'> RowLayout();<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:maroon'>//
Optionally set layout fields.</span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>layout.wrap = </span><span
style='color:navy'>true</span><span style='color:black'>;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:maroon'>// Set
the layout into the composite.</span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>shell.setLayout(layout);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:maroon'>//
Create the children of the composite.</span></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span><span
style='mso-tab-count:1'>   </span><span style='color:navy'>new</span>
Button(shell, SWT.PUSH).setText(<span style='color:teal'>&quot;B1&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;Wide Button 2&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;Button 3&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.pack();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.open();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>while</span> (!shell.isDisposed()) {</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:3'>          </span><span
style='color:navy'>if</span> (!display.readAndDispatch()) display.sleep();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>}</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>}</p>
<p class=Code style='margin-left:17.0pt'>}</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Running the above code results in
the following:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1063" type="#_x0000_t75" style='width:130.5pt;height:39.75pt'
fillcolor="window">
<v:imagedata src="./files/image003.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=174 height=53
src="./files/image004.jpg" v:shapes="_x0000_i1063"><![endif]></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>If the user resizes the shell so
that there is no longer room for <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>Button 3</span> on the right, the <i style='mso-bidi-font-style:
normal'>RowLayout</i> wraps <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>Button 3</span> to the next row, as follows:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1064" type="#_x0000_t75" style='width:105.75pt;height:56.25pt'
fillcolor="window">
<v:imagedata src="./files/image005.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=141 height=75
src="./files/image006.jpg" v:shapes="_x0000_i1064"><![endif]></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Using layouts is closely tied with
resize, as we shall see. Consequently, most of the examples in this document
show what would happen if the <i style='mso-bidi-font-style:normal'>Composite</i>
becomes smaller or larger, in order to illustrate how the <i style='mso-bidi-font-style:
normal'>Layout</i> works.</p>
<span style='font-size:18.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h2 style='margin-left:17.0pt'><a name="_Toc509864527"><span style='layout-grid-mode:
line'>FillLayout</span></a><span style='layout-grid-mode:line'><o:p></o:p></span></h2>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><i
style='mso-bidi-font-style:normal'>FillLayout</i> is the simplest layout class.
It lays out widgets in a single row or column, forcing them to be the same
size. Initially, the widgets will all be as tall as the tallest widget, and as
wide as the widest. <i style='mso-bidi-font-style:normal'>FillLayout</i> does
not wrap, and you cannot specify margins or spacing. You might use it to lay
out buttons in a task bar or tool bar, or to stack checkboxes in a <i
style='mso-bidi-font-style:normal'>Group</i>. <i style='mso-bidi-font-style:
normal'>FillLayout</i> can also be used when a <i style='mso-bidi-font-style:
normal'>Composite</i> only has one child. For example, if a <i
style='mso-bidi-font-style:normal'>Shell</i> has a single <i style='mso-bidi-font-style:
normal'>Group</i> child, <i style='mso-bidi-font-style:normal'>FillLayout</i>
will cause the <i style='mso-bidi-font-style:normal'>Group</i> to completely
fill the <i style='mso-bidi-font-style:normal'>Shell</i>.</p>
<p class=MsoHeader style='margin-left:17.0pt;mso-list:skip;tab-stops:.5in center 3.0in right 6.0in'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>Here is the
relevant portion of the example code. First we create a <i style='mso-bidi-font-style:
normal'>FillLayout</i>, then (if we want vertical) we set its <b
style='mso-bidi-font-weight:normal'>type</b> field, and then we set it into the
<i style='mso-bidi-font-style:normal'>Composite</i> (a <i style='mso-bidi-font-style:
normal'>Shell</i>). The <i style='mso-bidi-font-style:normal'>Shell</i> has
three pushbutton children, <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>B1</span>, <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>B2</span>, and <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>Button 3</span>. Note that in a <i style='mso-bidi-font-style:
normal'>FillLayout</i>, children are always the same size, and they fill all
available space.</p>
<p class=MsoHeader style='margin-left:17.0pt;mso-list:skip;tab-stops:.5in center 3.0in right 6.0in'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>FillLayout
fillLayout = <span style='color:navy'>new</span> FillLayout();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>fillLayout.type
= SWT.VERTICAL;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.setLayout(fillLayout);</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>The following table
shows the differences between a horizontal and vertical <i style='mso-bidi-font-style:
normal'>FillLayout</i>, initially and after the parent has grown.</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<table border=0 cellspacing=0 cellpadding=0 style='margin-left:17.0pt;
border-collapse:collapse;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
<tr>
<td width=145 valign=top style='width:108.9pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><b
style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
</td>
<td width=222 valign=top style='width:166.5pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<h5>Initial</h5>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<h5>After resize</h5>
</td>
</tr>
<tr>
<td width=145 valign=top style='width:108.9pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>fillLayout.type =
SWT.HORIZONTAL<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>(default)<o:p></o:p></b></p>
</td>
<td width=222 valign=top style='width:166.5pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1065" type="#_x0000_t75" style='width:118.5pt;height:35.25pt'
fillcolor="window">
<v:imagedata src="./files/image007.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=158 height=47
src="./files/image008.jpg" v:shapes="_x0000_i1065"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1066" type="#_x0000_t75" style='width:137.25pt;height:50.25pt'
fillcolor="window">
<v:imagedata src="./files/image009.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=183 height=67
src="./files/image010.jpg" v:shapes="_x0000_i1066"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=145 valign=top style='width:108.9pt;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>fillLayout.type =
SWT.VERTICAL<o:p></o:p></b></p>
</td>
<td width=222 valign=top style='width:166.5pt;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1067" type="#_x0000_t75" style='width:67.5pt;height:66pt'
fillcolor="window">
<v:imagedata src="./files/image011.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=90 height=88
src="./files/image012.jpg" v:shapes="_x0000_i1067"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1068" type="#_x0000_t75" style='width:137.25pt;height:66.75pt'
fillcolor="window">
<v:imagedata src="./files/image013.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=183 height=89
src="./files/image014.jpg" v:shapes="_x0000_i1068"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
</table>
<span style='font-size:18.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h2 style='margin-left:17.0pt'><a name="_Toc509864528">RowLayout</a></h2>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><i
style='mso-bidi-font-style:normal'>RowLayout</i> is more commonly used than <i
style='mso-bidi-font-style:normal'>FillLayout</i> because of its ability to
wrap, and because it provides configurable margins and spacing. <i
style='mso-bidi-font-style:normal'>RowLayout</i> has a number of configuration
fields. In addition, the height and width of each widget in a <i
style='mso-bidi-font-style:normal'>RowLayout</i> can be specified by setting a <i
style='mso-bidi-font-style:normal'>RowData</i> object into the widget using <b
style='mso-bidi-font-weight:normal'>setLayoutData</b>.</p>
<h3 style='margin-left:17.0pt'><a name="_Toc509864529">RowLayout Configuration
Fields</a></h3>
<h4 style='margin-left:17.0pt'><a name="_Toc509864530">Wrap</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>wrap</b> field controls whether or not the <i style='mso-bidi-font-style:
normal'>RowLayout</i> will wrap widgets into the next row if there isn’t enough
space in the current row. <i style='mso-bidi-font-style:normal'>RowLayouts</i>
wrap by default.</p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864531">Pack</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>If the <b style='mso-bidi-font-weight:
normal'>pack</b> field is true, widgets in a <i style='mso-bidi-font-style:
normal'>RowLayout</i> will take their natural size, and they will be aligned as
far to the left as possible. If packing is false, widgets will fill the
available space, similar to the widgets in a <i style='mso-bidi-font-style:
normal'>FillLayout</i>. <i style='mso-bidi-font-style:normal'>RowLayouts</i>
pack by default.</p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864532">Justify</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>If the <b style='mso-bidi-font-weight:
normal'>justify</b> field is true, widgets in a <i style='mso-bidi-font-style:
normal'>RowLayout</i> are spread across the available space from left to right.
If the parent <i style='mso-bidi-font-style:normal'>Composite</i> grows wider, the
extra space is distributed evenly among the widgets. If both <b
style='mso-bidi-font-weight:normal'>pack</b> and <b style='mso-bidi-font-weight:
normal'>justify</b> are true, widgets take their natural size, and the extra
space is placed between the widgets in order to keep them fully justified. By
default, <i style='mso-bidi-font-style:normal'>RowLayouts</i> do not justify.</p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864533">MarginLeft, MarginTop,
MarginRight, MarginBottom and Spacing</a></h4>
<p class=MsoHeader style='margin-left:17.0pt;tab-stops:.5in center 3.0in right 6.0in'>These
fields control the number of pixels between widgets (<b style='mso-bidi-font-weight:
normal'>spacing</b>) and the number of pixels between a widget and the side of
the parent <i style='mso-bidi-font-style:normal'>Composite</i> (<b
style='mso-bidi-font-weight:normal'>margin</b>). By default, <i
style='mso-bidi-font-style:normal'>RowLayouts</i> leave 3 pixels for margin and
spacing. The margin and spacing fields are shown in the following diagram.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1069" type="#_x0000_t75" style='width:247.5pt;height:79.5pt'
o:ole="" fillcolor="window">
<v:imagedata src="./files/image015.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=330 height=106
src="./files/image016.jpg" v:shapes="_x0000_i1069"><![endif]><!--[if gte mso 9]><xml>
<o:OLEObject Type="Embed" ProgID="PBrush" ShapeID="_x0000_i1069"
DrawAspect="Content" ObjectID="_1053162910">
</o:OLEObject>
</xml><![endif]--></p>
<span style='font-size:14.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h3 style='margin-left:17.0pt'><a name="_Toc509864534">RowLayout Examples</a></h3>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>The following
example code creates a <i style='mso-bidi-font-style:normal'>RowLayout</i>,
sets all of its fields to non-default values, and then sets it into a <i
style='mso-bidi-font-style:normal'>Shell</i>. </p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>RowLayout
rowLayout = <span style='color:navy'>new</span> RowLayout();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.wrap
= false;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.pack
= false;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.justify
= true;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.marginLeft
= 5;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.marginTop
= 5;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.marginRight
= 5;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.marginBottom
= 5;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>rowLayout.spacing
= 0;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>shell.setLayout(rowLayout);</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>If you are using
the default field values, you only need one line of code:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>shell.setLayout(<span
style='color:navy'>new</span> RowLayout());</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>In the table below,
the result of setting specific fields is shown.</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<table border=0 cellspacing=0 cellpadding=0 style='margin-left:17.0pt;
border-collapse:collapse;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
<tr>
<td width=127 valign=top style='width:95.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><b
style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
</td>
<td width=240 valign=top style='width:2.5in;border-top:none;border-left:none;
border-bottom:solid black .75pt;border-right:solid black .75pt;mso-border-left-alt:
solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<h5>Initial</h5>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<h5>After resize</h5>
</td>
</tr>
<tr>
<td width=127 valign=top style='width:95.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>wrap = true<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>pack = true<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>justify = false<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><span style='font-size:10.0pt;font-family:"Times New Roman"'>(defaults)<o:p></o:p></span></p>
</td>
<td width=240 valign=top style='width:2.5in;border-top:none;border-left:none;
border-bottom:solid black .75pt;border-right:solid black .75pt;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1070" type="#_x0000_t75" style='width:130.5pt;height:39.75pt'
fillcolor="window">
<v:imagedata src="./files/image017.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=174 height=53
src="./files/image018.jpg" v:shapes="_x0000_i1070"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1071" type="#_x0000_t75" style='width:106.5pt;height:56.25pt'
fillcolor="window">
<v:imagedata src="./files/image019.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=142 height=75
src="./files/image020.jpg" v:shapes="_x0000_i1071"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=127 valign=top style='width:95.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>wrap = false<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><span style='font-size:10.0pt;font-family:"Times New Roman"'>(clips
if not enough space)<o:p></o:p></span></p>
</td>
<td width=240 valign=top style='width:2.5in;border-top:none;border-left:none;
border-bottom:solid black .75pt;border-right:solid black .75pt;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1072" type="#_x0000_t75" style='width:130.5pt;height:39.75pt'
fillcolor="window">
<v:imagedata src="./files/image017.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=174 height=53
src="./files/image021.jpg" v:shapes="_x0000_i1072"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1073" type="#_x0000_t75" style='width:106.5pt;height:56.25pt'
fillcolor="window">
<v:imagedata src="./files/image022.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=142 height=75
src="./files/image023.jpg" v:shapes="_x0000_i1073"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=127 valign=top style='width:95.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>pack = false<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><span style='font-size:10.0pt;font-family:"Times New Roman"'>(all
widgets are the same size)<o:p></o:p></span></p>
</td>
<td width=240 valign=top style='width:2.5in;border-top:none;border-left:none;
border-bottom:solid black .75pt;border-right:solid black .75pt;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1074" type="#_x0000_t75" style='width:168.75pt;height:35.25pt'
fillcolor="window">
<v:imagedata src="./files/image024.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=225 height=47
src="./files/image025.jpg" v:shapes="_x0000_i1074"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1075" type="#_x0000_t75" style='width:148.5pt;height:56.25pt'
fillcolor="window">
<v:imagedata src="./files/image026.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=198 height=75
src="./files/image027.jpg" v:shapes="_x0000_i1075"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=127 valign=top style='width:95.4pt;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'>justify = true<o:p></o:p></b></p>
<p class=Code><b style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=Code><span style='font-size:10.0pt;font-family:"Times New Roman"'>(widgets
are spread across the available space)<o:p></o:p></span></p>
</td>
<td width=240 valign=top style='width:2.5in;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1076" type="#_x0000_t75" style='width:130.5pt;height:39.75pt'
fillcolor="window">
<v:imagedata src="./files/image028.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=174 height=53
src="./files/image029.jpg" v:shapes="_x0000_i1076"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=223 valign=top style='width:167.4pt;border:none;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><!--[if gte vml 1]><v:shape
id="_x0000_i1077" type="#_x0000_t75" style='width:156.75pt;height:38.25pt'
fillcolor="window">
<v:imagedata src="./files/image030.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=209 height=51
src="./files/image031.jpg" v:shapes="_x0000_i1077"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
</table>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<span style='font-size:14.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h3 style='margin-left:17.0pt'><a name="_Toc509864535">Using RowData Objects
with RowLayout</a></h3>
<p class=MsoNormal style='margin-left:17.0pt'>Each widget controlled by a <i
style='mso-bidi-font-style:normal'>RowLayout</i> can have its initial width and
height specified by setting a <i style='mso-bidi-font-style:normal'>RowData</i>
object into the widget. The following code uses <i style='mso-bidi-font-style:
normal'>RowData</i> objects to change the initial size of the <i
style='mso-bidi-font-style:normal'>Buttons</i> in a <i style='mso-bidi-font-style:
normal'>Shell</i>.</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.*;</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.widgets.*;</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>import</span>
org.eclipse.swt.layout.*;</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'>public</span>
<span style='color:navy'>class</span> RowDataExample {</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span><span
style='color:navy'>public</span> <span style='color:navy'>static</span> <span
style='color:navy'>void</span> main(String[] args) {</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Display
display = <span style='color:navy'>new</span> Display();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Shell
shell = <span style='color:navy'>new</span> Shell(display);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.setLayout(<span
style='color:navy'>new</span> RowLayout());</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Button
button1 = <span style='color:navy'>new</span> Button(shell, SWT.PUSH);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setText(<span
style='color:teal'>&quot;Button 1&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setLayoutData(<span
style='color:navy'>new</span> RowData(50, 40));</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Button
button2 = <span style='color:navy'>new</span> Button(shell, SWT.PUSH);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button2.setText(<span
style='color:teal'>&quot;Button 2&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button2.setLayoutData(<span
style='color:navy'>new</span> RowData(50, 30));</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Button
button3 = <span style='color:navy'>new</span> Button(shell, SWT.PUSH);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button3.setText(<span
style='color:teal'>&quot;Button 3&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button3.setLayoutData(<span
style='color:navy'>new</span> RowData(50, 20));</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.pack();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.open();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>while</span> (!shell.isDisposed()) {</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:3'>          </span><span
style='color:navy'>if</span> (!display.readAndDispatch()) display.sleep();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>}</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:1'>    </span>}</p>
<p class=Code style='margin-left:17.0pt'>}</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Here is what you see when you run
the above code.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1078" type="#_x0000_t75" style='width:129.75pt;height:54.75pt'
fillcolor="window">
<v:imagedata src="./files/image032.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=173 height=73
src="./files/image033.jpg" v:shapes="_x0000_i1078"><![endif]></p>
<span style='font-size:18.0pt;font-family:Arial;mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
clear=all style='page-break-before:always'>
</span>
<h2 style='margin-left:17.0pt'><a name="_Toc509864536">GridLayout</a></h2>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><i
style='mso-bidi-font-style:normal'>GridLayout</i> is the most useful and
powerful of the standard layouts, but it is also the most complicated. With a <i
style='mso-bidi-font-style:normal'>GridLayout</i>, the widget children of a <i
style='mso-bidi-font-style:normal'>Composite</i> are laid out in a grid. <i
style='mso-bidi-font-style:normal'>GridLayout</i> has a number of configuration
fields, and, like <i style='mso-bidi-font-style:normal'>RowLayout</i>, the
widgets it lays out can have an associated layout data object, called <i
style='mso-bidi-font-style:normal'>GridData</i>. The power of <i
style='mso-bidi-font-style:normal'>GridLayout</i> lies in the ability to
configure <i style='mso-bidi-font-style:normal'>GridData</i> for each widget
controlled by the <i style='mso-bidi-font-style:normal'>GridLayout</i>.</p>
<h3 style='margin-left:17.0pt'><a name="_Toc509864537">GridLayout Configuration
Fields</a></h3>
<h4 style='margin-left:17.0pt'><a name="_Toc509864538">NumColumns</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>numColumns</b> field is the most important field in a <i
style='mso-bidi-font-style:normal'>GridLayout</i>, and it is usually the first
field an application will set. Widgets are laid out in columns from left to
right, and a new row is created when <b style='mso-bidi-font-weight:normal'>numColumns</b>
+ 1 widgets are added to the <i style='mso-bidi-font-style:normal'>Composite</i>.
The default is to have only 1 column. The following code creates a <i
style='mso-bidi-font-style:normal'>Shell</i> with five <i style='mso-bidi-font-style:
normal'>Button</i> children of various widths, managed by a <i
style='mso-bidi-font-style:normal'>GridLayout</i>. The table below shows the
grid when <b style='mso-bidi-font-weight:normal'>numColumns</b> is set to 1, 2,
or 3.</p>
<p class=Code style='margin-left:17.0pt'><span style='color:navy'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Display
display = <span style='color:navy'>new</span> Display();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Shell
shell = <span style='color:navy'>new</span> Shell(display);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>GridLayout
gridLayout = <span style='color:navy'>new</span> GridLayout();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>gridLayout.numColumns
= 3;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.setLayout(gridLayout);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;B1&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;Wide Button 2&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;Button 3&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;B4&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>new</span> Button(shell, SWT.PUSH).setText(<span
style='color:teal'>&quot;Button 5&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.pack();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>shell.open();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span><span
style='color:navy'>while</span> (!shell.isDisposed()) {</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:3'>          </span><span
style='color:navy'>if</span> (!display.readAndDispatch()) display.sleep();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>}</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<table border=0 cellspacing=0 cellpadding=0 style='margin-left:17.0pt;
border-collapse:collapse;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
<tr>
<td width=197 valign=top style='width:2.05in;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'>numColumns = 1<o:p></o:p></b></p>
</td>
<td width=197 valign=top style='width:2.05in;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'>numColumns = 2<o:p></o:p></b></p>
</td>
<td width=197 valign=top style='width:2.05in;border:none;border-bottom:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'>numColumns = 3<o:p></o:p></b></p>
</td>
</tr>
<tr>
<td width=197 valign=top style='width:2.05in;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shape id="_x0000_i1079"
type="#_x0000_t75" style='width:84pt;height:117.75pt' fillcolor="window">
<v:imagedata src="./files/image034.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=112 height=157
src="./files/image035.jpg" v:shapes="_x0000_i1079"><![endif]><o:p></o:p></b></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><b
style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
</td>
<td width=197 valign=top style='width:2.05in;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1080" type="#_x0000_t75" style='width:113.25pt;height:80.25pt'
fillcolor="window">
<v:imagedata src="./files/image036.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=151 height=107
src="./files/image037.jpg" v:shapes="_x0000_i1080"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
<td width=197 valign=top style='width:2.05in;border:none;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1081" type="#_x0000_t75" style='width:134.25pt;height:61.5pt'
fillcolor="window">
<v:imagedata src="./files/image038.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image039.jpg" v:shapes="_x0000_i1081"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
</table>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA'><br clear=all style='page-break-before:always'>
</span>
<h4 style='margin-left:17.0pt'><a name="_Toc509864539">MakeColumnsEqualWidth</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>makeColumnsEqualWidth</b> field forces the columns to be the same width.
The default is false. If we change the example above to have 3 columns of equal
width, this is what we would get (note that in the absence of further
instruction, widgets are left-justified in their columns):</p>
<p class=MsoHeader style='margin-left:17.0pt;tab-stops:.5in center 3.0in right 6.0in'><!--[if gte vml 1]><o:wrapblock><v:shape
id="_x0000_s1053" type="#_x0000_t75" style='position:absolute;left:0;
text-align:left;margin-left:76.05pt;margin-top:0;width:249.8pt;height:104.25pt;
z-index:1' o:allowincell="f">
<v:imagedata src="./files/image040.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout'>
<table cellpadding=0 cellspacing=0 align=left>
<tr>
<td width=101 height=0></td>
</tr>
<tr>
<td></td>
<td><img width=333 height=139
src="./files/image041.jpg" v:shapes="_x0000_s1053"></td>
</tr>
</table>
</span><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<br style='mso-ignore:vglayout' clear=ALL>
<h4 style='margin-left:17.0pt'><a name="_Toc509864540">MarginWidth,
MarginHeight, HorizontalSpacing, and VerticalSpacing</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>margin</b> and <b style='mso-bidi-font-weight:normal'>spacing</b>
fields in a <i style='mso-bidi-font-style:normal'>GridLayout</i> are similar to
those in a <i style='mso-bidi-font-style:normal'>RowLayout</i>. The difference
is that the left and right margins are grouped into <b style='mso-bidi-font-weight:
normal'>marginWidth</b>, and the top and bottom margins are grouped into <b
style='mso-bidi-font-weight:normal'>marginHeight</b>. Also, in a <i
style='mso-bidi-font-style:normal'>GridLayout</i> you can specify <b
style='mso-bidi-font-weight:normal'>verticalSpacing</b>, whereas in a <i
style='mso-bidi-font-style:normal'>RowLayout</i>, only <b style='mso-bidi-font-weight:
normal'>horizontalSpacing</b> applied.</p>
<h3 style='margin-left:17.0pt'><a name="_Toc509864541">GridData Object Fields</a></h3>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><i
style='mso-bidi-font-style:normal'>GridData</i> is the layout data object
associated with <i style='mso-bidi-font-style:normal'>GridLayout</i>. To set a <i
style='mso-bidi-font-style:normal'>GridData</i> object into a widget, you use
the <b style='mso-bidi-font-weight:normal'>setLayoutData</b> method. For
example, to set the <i style='mso-bidi-font-style:normal'>GridData</i> for a <i
style='mso-bidi-font-style:normal'>Button</i>, we could do the following:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>Button
button1 = <span style='color:navy'>new</span> Button(shell, SWT.PUSH);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setText(<span
style='color:teal'>&quot;B1&quot;</span>);</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setLayoutData(<span
style='color:navy'>new</span> GridData());</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><span
style="mso-spacerun: yes"> </span></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>Of course, this
code just creates a <i style='mso-bidi-font-style:normal'>GridData</i> object
with all of its fields set to their default values, which is the same as not
setting the layout data at all. There are two ways to create a <i
style='mso-bidi-font-style:normal'>GridData</i> object with certain fields set.
The first is to set the fields directly, like this:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>GridData
gridData = <span style='color:navy'>new</span> GridData();</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>gridData.horizontalAlignment
= GridData.FILL;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>gridData.grabExcessHorizontalSpace
= true;</p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setLayoutData(gridData);</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>The second is to
take advantage of convenience API – style bits defined by <i style='mso-bidi-font-style:
normal'>GridData</i>:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setLayoutData(<span
style='color:navy'>new</span> GridData(GridData.HORIZONTAL_ALIGN_FILL |
GridData.GRAB_HORIZONTAL));</p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt;mso-list:skip'>In fact, certain
common style bit combinations are provided for further convenience:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='mso-tab-count:2'>       </span>button1.setLayoutData(new
GridData(GridData.FILL_HORIZONTAL));</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Note that FILL_ convenience
styles set both fill alignment <i style='mso-bidi-font-style:normal'>and</i>
grab. <i style='mso-bidi-font-style:normal'>GridData</i> style bits can only be
used for boolean and enumeration fields. Numeric fields must be set directly.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>One final note about <i>GridData</i>
objects before we get into their fields: do not reuse <i>GridData</i> objects. Every
widget in a <i>Composite</i> that is managed by a <i>GridLayout</i> must have a
unique <i>GridData</i> object. If the layout data for a widget in a <i>GridLayout</i>
is null at layout time, a unique <i>GridData</i> object is created for it.</p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864542">HorizontalAlignment and
VerticalAlignment</a> </h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>alignment</b> fields specify where to place a widget horizontally
and/or vertically within its grid cell. Each alignment field can have any of
the following values:</p>
<p class=MsoNormal style='margin-left:71.0pt;text-indent:-.25in;mso-list:l3 level1 lfo4;
tab-stops:list .75in'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>BEGINNING</p>
<p class=MsoNormal style='margin-left:71.0pt;text-indent:-.25in;mso-list:l3 level1 lfo4;
tab-stops:list .75in'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>CENTER</p>
<p class=MsoNormal style='margin-left:71.0pt;text-indent:-.25in;mso-list:l3 level1 lfo4;
tab-stops:list .75in'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>END</p>
<p class=MsoNormal style='margin-left:71.0pt;text-indent:-.25in;mso-list:l3 level1 lfo4;
tab-stops:list .75in'><![if !supportLists]><span style='font-family:Symbol'>·<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>FILL</p>
<p class=MsoNormal style='margin-left:17.0pt'>The default horizontalAlignment
is BEGINNING (or left-aligned). The default verticalAlignment is CENTER.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Let’s go back to our five-button
example with three columns, and we will vary the <b style='mso-bidi-font-weight:
normal'>horizontalAlignment</b> of <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>Button 5</span>.</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<table border=0 cellspacing=0 cellpadding=0 style='margin-left:17.0pt;
border-collapse:collapse;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
<tr>
<td width=319 valign=top style='width:239.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code>horizontalAlignment = GridData.BEGINNING<b style='mso-bidi-font-weight:
normal'><o:p></o:p></b></p>
</td>
<td width=271 valign=top style='width:203.4pt;border:none;border-bottom:solid black .75pt;
mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></b></p>
<p class=MsoNormal align=center style='text-align:center'><b
style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shape id="_x0000_i1082"
type="#_x0000_t75" style='width:134.25pt;height:61.5pt' fillcolor="window">
<v:imagedata src="./files/image042.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image043.jpg" v:shapes="_x0000_i1082"><![endif]><o:p></o:p></b></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><b
style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
</td>
</tr>
<tr>
<td width=319 valign=top style='width:239.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code>horizontalAlignment = GridData.CENTER<b style='mso-bidi-font-weight:
normal'><o:p></o:p></b></p>
</td>
<td width=271 valign=top style='width:203.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1083" type="#_x0000_t75" style='width:134.25pt;height:61.5pt'
fillcolor="window">
<v:imagedata src="./files/image044.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image045.jpg" v:shapes="_x0000_i1083"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=319 valign=top style='width:239.4pt;border-top:none;border-left:
none;border-bottom:solid black .75pt;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code>horizontalAlignment = GridData.END<b style='mso-bidi-font-weight:
normal'><o:p></o:p></b></p>
</td>
<td width=271 valign=top style='width:203.4pt;border:none;border-bottom:solid black .75pt;
mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1084" type="#_x0000_t75" style='width:134.25pt;height:61.5pt'
fillcolor="window">
<v:imagedata src="./files/image046.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image047.jpg" v:shapes="_x0000_i1084"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
<tr>
<td width=319 valign=top style='width:239.4pt;border:none;border-right:solid black .75pt;
mso-border-top-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=Code><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code>horizontalAlignment = GridData.FILL<b style='mso-bidi-font-weight:
normal'><o:p></o:p></b></p>
</td>
<td width=271 valign=top style='width:203.4pt;border:none;mso-border-top-alt:
solid black .75pt;mso-border-left-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1085" type="#_x0000_t75" style='width:134.25pt;height:61.5pt'
fillcolor="window">
<v:imagedata src="./files/image048.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image049.jpg" v:shapes="_x0000_i1085"><![endif]></p>
<p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
</table>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864543">HorizontalIndent</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>horizontalIndent</b> field allows you to move a widget to the right by a
specified number of pixels. This field is typically only useful when the <b
style='mso-bidi-font-weight:normal'>horizontalAlignment</b> is BEGINNING. We
cannot use a style bit to set the indent, so we will indent <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 5 </span>in
our example by 4 pixels as follows:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><!--[if gte vml 1]><o:wrapblock><v:shape
id="_x0000_s1061" type="#_x0000_t75" style='position:absolute;left:0;
text-align:left;margin-left:0;margin-top:0;width:134.25pt;height:61.5pt;
z-index:3;mso-wrap-edited:f;mso-position-horizontal:left;
mso-position-vertical:top' wrapcoords="-121 0 -121 21337 21600 21337 21600 0 -121 0">
<v:imagedata src="./files/image050.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image051.jpg" v:shapes="_x0000_s1061"><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<br style='mso-ignore:vglayout' clear=ALL>
<p class=Code style='margin-left:17.0pt'>GridData gridData = <span
style='color:navy'>new</span> GridData();</p>
<p class=Code style='margin-left:17.0pt'>gridData.horizontalIndent = 4;</p>
<p class=Code style='margin-left:17.0pt'>button5.setLayoutData(gridData);</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864544">HorizontalSpan and
VerticalSpan</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>span</b> fields let widgets occupy more than one grid cell. They are
often used in conjunction with FILL alignment. We can make <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 5</span> in
our example span the last two cells as follows:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><!--[if gte vml 1]><o:wrapblock><v:shape
id="_x0000_s1060" type="#_x0000_t75" style='position:absolute;left:0;
text-align:left;margin-left:0;margin-top:0;width:134.25pt;height:61.5pt;
z-index:2;mso-wrap-edited:f;mso-position-horizontal:left;
mso-position-vertical:top' wrapcoords="-121 0 -121 21337 21600 21337 21600 0 -121 0"
o:allowoverlap="f">
<v:imagedata src="./files/image052.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image053.jpg" v:shapes="_x0000_s1060"><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<br style='mso-ignore:vglayout' clear=ALL>
<p class=Code style='margin-left:17.0pt'>GridData gridData = <span
style='color:navy'>new</span> GridData();</p>
<p class=Code style='margin-left:17.0pt'>gridData.horizontalAlignment =
GridData.FILL;<span style='font-size:10.0pt'> </span></p>
<p class=Code style='margin-left:17.0pt'>gridData.horizontalSpan = 2;</p>
<p class=Code style='margin-left:17.0pt'>button5.setLayoutData(gridData);</p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>If we decide to make <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Wide Button 2</span>
span two cells instead, we would end up with this:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><!--[if gte vml 1]><o:wrapblock><v:shape
id="_x0000_s1062" type="#_x0000_t75" style='position:absolute;left:0;
text-align:left;margin-left:5.55pt;margin-top:0;width:113.25pt;height:61.5pt;
z-index:4;mso-position-horizontal:absolute;mso-position-vertical:top'>
<v:imagedata src="./files/image054.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout'>
<table cellpadding=0 cellspacing=0 align=left>
<tr>
<td width=7 height=0></td>
</tr>
<tr>
<td></td>
<td><img width=151 height=82
src="./files/image055.jpg" v:shapes="_x0000_s1062"></td>
</tr>
</table>
</span><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<br style='mso-ignore:vglayout' clear=ALL>
<p class=Code style='margin-left:17.0pt'>GridData gridData = <span
style='color:navy'>new</span> GridData();</p>
<p class=Code style='margin-left:17.0pt'>gridData.horizontalAlignment =
GridData.FILL;</p>
<p class=Code style='margin-left:17.0pt'>gridData.horizontalSpan = 2;</p>
<p class=Code style='margin-left:17.0pt'>button2.setLayoutData(gridData);</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Or we could make <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 3</span>
span two cells vertically:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><!--[if gte vml 1]><o:wrapblock><v:shape
id="_x0000_s1063" type="#_x0000_t75" style='position:absolute;left:0;
text-align:left;margin-left:0;margin-top:0;width:134.25pt;height:61.5pt;
z-index:5;mso-position-horizontal:left;mso-position-vertical:top'>
<v:imagedata src="./files/image056.png" o:title=""/>
<w:wrap type="topAndBottom" anchorx="page"/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image057.jpg" v:shapes="_x0000_s1063"><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
style='mso-ignore:vglayout' clear=ALL>
<![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<br style='mso-ignore:vglayout' clear=ALL>
<p class=Code style='margin-left:17.0pt'>GridData gridData = <span
style='color:navy'>new</span> GridData();</p>
<p class=Code style='margin-left:17.0pt'>gridData.verticalAlignment =
GridData.FILL;</p>
<p class=Code style='margin-left:17.0pt'>gridData.verticalSpan = 2;</p>
<p class=Code style='margin-left:17.0pt'>button3.setLayoutData(gridData);</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864545">GrabExcessHorizontalSpace
and GrabExcessVerticalSpace</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b style='mso-bidi-font-weight:
normal'>grabExcessHorizontalSpace</b> and <b style='mso-bidi-font-weight:normal'>grabExcessVerticalSpace</b>
fields are typically used for larger widgets such as <i style='mso-bidi-font-style:
normal'>Texts</i> or <i style='mso-bidi-font-style:normal'>Lists</i> to allow
them to grow if their containing <i style='mso-bidi-font-style:normal'>Composite</i>
grows. If a <i style='mso-bidi-font-style:normal'>Text</i> is grabbing excess
horizontal space and the user resizes the <i style='mso-bidi-font-style:normal'>Shell</i>
wider, then the <i style='mso-bidi-font-style:normal'>Text</i> will get all of the
new horizontal space and other widgets in the same row will stay their original
width. Of course, the widget that is grabbing excess space is also the first
one to shrink when the <i style='mso-bidi-font-style:normal'>Shell</i> gets
smaller. It is easiest to always think of the <b style='mso-bidi-font-weight:
normal'>grabExcessSpace</b> fields in the context of resizing. For a simple
example, let’s reuse the previous example where <span style='font-size:9.0pt;
mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>Button 3</span> spanned two cells vertically. Here it is
again:</p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1086" type="#_x0000_t75" style='width:134.25pt;height:61.5pt'
fillcolor="window">
<v:imagedata src="./files/image056.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=179 height=82
src="./files/image058.jpg" v:shapes="_x0000_i1086"><![endif]></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>If we resize this window, the
only thing that happens is the window gets bigger:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1087" type="#_x0000_t75" style='width:151.5pt;height:84pt'
fillcolor="window">
<v:imagedata src="./files/image059.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=202 height=112
src="./files/image060.jpg" v:shapes="_x0000_i1087"><![endif]></p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>Now we will tell <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 3 </span>to
grab excess horizontal and vertical space, and <span style='font-size:9.0pt;
mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>B1</span> and <span style='font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:"Courier New";mso-bidi-font-family:"Times New Roman";
layout-grid-mode:line'>B4</span> to fill vertically (without grabbing), and we
resize the window again:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1088" type="#_x0000_t75" style='width:178.5pt;height:87pt'
fillcolor="window">
<v:imagedata src="./files/image061.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=238 height=116
src="./files/image062.jpg" v:shapes="_x0000_i1088"><![endif]></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>This time, <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 3 </span>grew
in both directions, and <span style='font-size:9.0pt;mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-bidi-font-family:"Times New Roman";layout-grid-mode:
line'>B4</span> grew vertically. The other buttons stayed their original sizes.
Because <span style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:
"Courier New";mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button
3</span> was grabbing vertically and it spans two rows, the <i
style='mso-bidi-font-style:normal'>last</i> row that it spans grew taller. Note
that <span style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>B1</span> did not
grow – although it is filling vertically – because its row did not grow. Since <span
style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";layout-grid-mode:line'>Button 3</span>
was grabbing horizontally, its column grew wider, and since it was filling
horizontally, it grew wider to fill the column. Here is the code for all five
buttons:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>Button button1 = </span><span
style='color:navy'>new</span><span style='color:black'> Button(shell,
SWT.PUSH);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button1.setText(</span><span
style='color:teal'>&quot;B1&quot;</span><span style='color:black'>);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>GridData gridData = </span><span
style='color:navy'>new</span><span style='color:black'> GridData();<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.verticalAlignment =
GridData.FILL;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button1.setLayoutData(gridData);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:navy'>new</span><span
style='color:black'> Button(shell, SWT.PUSH).setText(</span><span
style='color:teal'>&quot;Wide Button 2&quot;</span><span style='color:black'>);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>Button button3 = </span><span
style='color:navy'>new</span><span style='color:black'> Button(shell,
SWT.PUSH);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button3.setText(</span><span
style='color:teal'>&quot;Button 3&quot;</span><span style='color:black'>);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData = </span><span style='color:
navy'>new</span><span style='color:black'> GridData();<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.verticalAlignment =
GridData.FILL;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.verticalSpan = 2;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.grabExcessVerticalSpace = </span><span
style='color:navy'>true</span><span style='color:black'>;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.horizontalAlignment =
GridData.FILL;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.grabExcessHorizontalSpace = </span><span
style='color:navy'>true</span><span style='color:black'>;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button3.setLayoutData(gridData);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>Button button4 = </span><span
style='color:navy'>new</span><span style='color:black'> Button(shell,
SWT.PUSH);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button4.setText(</span><span
style='color:teal'>&quot;B4&quot;</span><span style='color:black'>);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData = </span><span style='color:
navy'>new</span><span style='color:black'> GridData();<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>gridData.verticalAlignment =
GridData.FILL;<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span>button4.setLayoutData(gridData);<o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=Code style='margin-left:17.0pt'><span style='color:black'><span
style='mso-tab-count:2'>       </span></span><span style='color:navy'>new</span><span
style='color:black'> Button(shell, SWT.PUSH).setText(</span><span
style='color:teal'>&quot;Button 5&quot;</span><span style='color:black'>);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>In a typical application window,
you often want to have at least one widget that is grabbing. If more than one
widget is trying to grab the same space, then the excess space is shared evenly
among the grabbing widgets:</p>
<p class=Code style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal align=center style='margin-left:17.0pt;text-align:center'><!--[if gte vml 1]><v:shape
id="_x0000_i1089" type="#_x0000_t75" style='width:84pt;height:42.75pt'
fillcolor="window">
<v:imagedata src="./files/image063.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=112 height=57
src="./files/image064.jpg" v:shapes="_x0000_i1089"><![endif]><span
style='mso-tab-count:1'>  </span><!--[if gte vml 1]><v:shape id="_x0000_i1090"
type="#_x0000_t75" style='width:184.5pt;height:42.75pt' fillcolor="window">
<v:imagedata src="./files/image065.png" o:title=""/>
</v:shape><![endif]--><![if !vml]><img width=246 height=57
src="./files/image066.jpg" v:shapes="_x0000_i1090"><![endif]></p>
<p class=MsoNormal style='margin-left:17.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='margin-left:17.0pt'>One final point to note about
grabbing. If a widget is grabbing excess horizontal space and its parent <i
style='mso-bidi-font-style:normal'>Composite</i> grows wider, then the entire <i
style='mso-bidi-font-style:normal'>column</i> containing that widget grows
wider. If a widget is grabbing excess vertical space and its parent <i
style='mso-bidi-font-style:normal'>Composite</i> grows taller, then the entire <i
style='mso-bidi-font-style:normal'>row</i> containing that widget grows taller.
The implication of this is that if any other widget in the affected column or
row has <i style='mso-bidi-font-style:normal'>fill</i> alignment, then it will
stretch also. Widgets that have beginning, center, or end alignment will not
stretch – they will stay at the beginning, center or end of the wider column or
taller row.</p>
<h4 style='margin-left:17.0pt'><a name="_Toc509864546">WidthHint and HeightHint</a></h4>
<p class=MsoNormal style='margin-left:17.0pt'>The <b