﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-FORTUNE-随笔分类-我的学习笔记</title><link>http://www.blogjava.net/fortune/category/7609.html</link><description>THE WAY TO THE MASTER...</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 07:43:28 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 07:43:28 GMT</pubDate><ttl>60</ttl><item><title>java  流与文件</title><link>http://www.blogjava.net/fortune/archive/2006/03/14/35251.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Tue, 14 Mar 2006 08:13:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/14/35251.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/35251.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/14/35251.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/35251.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/35251.html</trackback:ping><description><![CDATA[<FONT size=4>在java中可以读出一系列字节的对象称为“输入流”，而能向其写入一系列字节的对象称为“输出流”。这2种对象分别是用抽象类InputStream和OutputStream来实现的。对于Unicode格式保存的信息（每个字符都用了2个字节来存储），有专门的类处理，这些类是从抽象类Reader和Writer继承而来。<BR><BR>java以这4个抽象类为基础，衍生出一系列具体的类，几乎可以完成所有的输入/输出过程。<BR><BR>InputStream类提供了一个抽象方法：abstract&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;read（）<BR>读取一个字节并将它返回，由此类衍生出来的其它具体类都会覆盖这个方法，以提供有用的功能。<BR>类似的，OutputStream类定义了抽象方法abstract&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;write（int&nbsp; b）<BR><BR>完成流的读写操作后应记住要用close（）方法将其关闭。关闭输出流的同时也会刷新输出流使用的缓冲区：在缓冲区中等待组合成一个较大的数据包的临时存储的字符，都会通过网络传送出去。特别是，加入没有关闭一个文件，最后一个字节报可能永远都不会投递出去。<BR><BR>InputStream和OutputStream类允许我们读取单独的字节和字节数组，它们不对字符串及数字进行读写。DataInputStream和DataOutputStream允许对所有基本java类型进行读写。<BR>对于Unicode文本，需使用Reader和Writer衍生出的类，它提供的基本方法和InputStream和OutputStream类似：abstract&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;read（）<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abstract&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;write（int&nbsp; b）<BR>read方法返回的要么是个Unicode字符（0-65535间的一个整数）要么是-1（已抵达文件末尾）<BR>无论是read还是write方法都会阻塞线程的运行，直到字节被实际读出或写入为止。利用available方法，我们可以检查目前能够读取的字节数。<BR><BR>int&nbsp;&nbsp;&nbsp;byteAvailable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp; System.in.available（）；<BR>if&nbsp;&nbsp;&nbsp;（byteAvailable&nbsp; 〉 0） <BR>{byte[]&nbsp;&nbsp; data&nbsp; =&nbsp; new byte [byteAvailable]；<BR>&nbsp;&nbsp;&nbsp;System.in.read（data）；<BR>}<BR><BR><FONT face="Courier New">FileInputStream</FONT>&nbsp;和 <TT>FileOutputStream</TT> 使我们能将磁盘文件和输入流及输出流关联起来。<BR>FileInputStream fin = new FileInputStream("employee.dat");<BR>也可以<BR>File f = new File("employee.dat");<BR>FileInputStream fin = new FileInputStream(f);<BR><BR><FONT face="Courier New">与InputStream</FONT> and <TT>OutputStream</TT> 类似， 它也仅支持字节级的读写操作，只能从fin对象中读取字节和字节数组：byte b = (byte) fin.read();<BR><BR>FileOutputStream（String name）新建一个name指定的文件输出流，该方法会自动删除同名的任何现存文件！！！<BR><BR>文本流<BR><BR>二进制的输入输出速度很快效率很高但是人无法看懂这种格式。java使用的是Unicode字符<BR><BR>File, File(Input/Output)Stream, RandomAccessFile是处理本地文件的类<BR><BR>Data(Input/Output)Stream是一个过滤流的子类,借此可以读写各种基本数据, 在文件和网络中经常使用.如: readByte, writeBoolean等. <BR><BR>Buffered(Input/Output)Stream的作用是在数据送到目的之前先缓存,达到一定数量时再送到目的,用已减少阻塞次数. <BR><BR>Piped(Input/Output)Stream适合与一个处理的输出作为另一个处理的输入的情况<BR><BR><BR><BR>&nbsp;</FONT> ！要想以二进制格式写入数据，使用DataOutputStream，要想以文本格式写入数据，使用PrintWriter<BR>二进制读入使用DataInputStream，可读取文本格式的数据Java并未提供这样的类。唯一用来处理文本输入的是BufferedReader类它包含了一个方法readLine。<BR><BR><BR><BR><img src ="http://www.blogjava.net/fortune/aggbug/35251.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-14 16:13 <a href="http://www.blogjava.net/fortune/archive/2006/03/14/35251.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Basic Controls -- Text</title><link>http://www.blogjava.net/fortune/archive/2006/03/13/35074.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Mon, 13 Mar 2006 08:30:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/13/35074.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/35074.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/13/35074.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/35074.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/35074.html</trackback:ping><description><![CDATA[<STRONG>Text Hierarchy<BR><BR><BR><IMG height=70 alt=graphics/07inf07.gif src="mk:@MSITStore:E:\java学习资料\swt教程\Addison.Wesley.Professional.SWT.The.Standard.Widget.Toolkit.Volume.1.Jun.2004.eBook-DDU.chm::/0321256638/images/0321256638/graphics/07inf07.gif" width=132 border=0><BR><BR>Text Styles<BR></STRONG><BR>
<TABLE cellSpacing=0 cellPadding=4 rules=rows frame=hsides>
<THEAD>
<TR>
<TH class=thead style="BACKGROUND-COLOR: #dddddd" vAlign=top align=left>
<P class=docText><SPAN class=docEmphBoldItalic>Style</SPAN></P></TH>
<TH class=thead style="BACKGROUND-COLOR: #dddddd" vAlign=top align=left>
<P class=docText><SPAN class=docEmphBoldItalic>Description</SPAN></P></TH></TR></THEAD>
<TBODY>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.SINGLE</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Allow a single line to be edited&nbsp; 单行</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.MULTI</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Allow multiple lines to be edited&nbsp; 多行</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.READ_ONLY</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Make the control noneditable&nbsp;&nbsp;&nbsp;&nbsp; 不可编辑</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.WRAP</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Allow strings to wrap instead of scrolling 自动换行</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.LEFT</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Left-align the contents of the control&nbsp;&nbsp;&nbsp; 左对齐</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.CENTER</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Center-align the contents of the control&nbsp; 中间对齐</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.RIGHT</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Right-align the contents of the control&nbsp;&nbsp; 右对齐</P></TD></TR></TBODY></TABLE><BR><BR><STRONG>Text Events</STRONG><BR><BR>
<TABLE cellSpacing=0 cellPadding=4 rules=rows frame=hsides>
<THEAD>
<TR>
<TH class=thead style="BACKGROUND-COLOR: #dddddd" vAlign=top align=left>
<P class=docText><SPAN class=docEmphBoldItalic>Event</SPAN></P></TH>
<TH class=thead style="BACKGROUND-COLOR: #dddddd" vAlign=top align=left>
<P class=docText><SPAN class=docEmphBoldItalic>&nbsp;&nbsp;&nbsp;&nbsp; Description</SPAN></P></TH></TR></THEAD>
<TBODY>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.DefaultSelection</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>&nbsp;&nbsp;&nbsp;&nbsp; Default selection occurred (user pressed &lt;Enter&gt;)</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.Modify</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>&nbsp;&nbsp;&nbsp;&nbsp; Text has changed in the control&nbsp; 控件中的文本内容发生了改变</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.Verify</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>&nbsp;&nbsp;&nbsp;&nbsp; Text is to be validated in the control&nbsp; 文本内容需要验证</P></TD></TR></TBODY></TABLE><BR>text控件支持"plain"text，这意味着text中的字符必须都是同样的字体和颜色，如果需要 更多的功能就使用<SPAN class=docEmphasis>org.eclipse.swt.custom.StyledText（eclipse为用户定制的）注意StyledText不是本地（native）控件<BR><BR>一共有2种类型的text控件：单行的和多行的<BR><BR><BR><STRONG>Single-Line and Multiline Text Controls</STRONG><BR><BR>SWT.SINGLE <BR><BR>Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);<BR>text.setText("Texan");<BR></SPAN><BR><BR>&nbsp;SWT.MULTI<BR>与单行的text不同它可以含有scroll bar&nbsp; （通过设置SWT.H_SCROLL or SWT.V_SCROLL ）<BR><BR>int style =<BR>&nbsp;&nbsp;&nbsp; SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;<BR>Text text = new Text(parent, style);<BR><BR><BR><STRONG>String Operations</STRONG><BR><BR><SPAN class=docEmphStrong>setText(String string)</SPAN><BR><BR><SPAN class=docEmphStrong>getText()</SPAN> <BR><BR><SPAN class=docEmphStrong>getText(int start, int end)&nbsp; 获取text的文本内容从start到end<BR><SPAN class=docEmphStrong>getCharCount()</SPAN>&nbsp; 返回字符的数目<BR><BR><BR><STRONG>Passwords and the Echo Character</STRONG><BR><BR>int style = SWT.SINGLE | SWT.BORDER | SWT.PASSWORD;<BR><BR>Text text = new Text(parent, style);<BR><BR>text.setText("fred54"); //在text上不会显示"fred54"，而是以echo字符代替<BR><BR>注意在不同的平台上echo字符是不同的，我们常见的密码echo字符是“*”，可以自己设置echo字符<BR><SPAN class=docEmphStrong><BR>setEchoChar(char echo)如果设置的字符是'\0'则不再隐藏字符，当前的字符被显示</SPAN><BR><SPAN class=docEmphStrong>getEchoChar()</SPAN> 返回setEchoChar函数设置的echo，如果未设置则返回'\0'，如果使用了SWT.PASSWORD 则返回的字符不确定<BR>通常来说自己设置echo字符是不明智的，因为这是平台look and feel的一部分。<BR><BR><BR><STRONG>&nbsp;Lines and Line Height</STRONG><BR><BR><SPAN class=docEmphStrong>getLineCount()</SPAN> 返回行数<BR><SPAN class=docEmphStrong>getLineHeight()</SPAN> 返回每行高度（像素）该值与字符的高度并不相同，因为行间有空隙<BR><BR>public static void main(String[] args) {<BR><BR>&nbsp;&nbsp;&nbsp; Display display = new Display();<BR><BR>&nbsp;&nbsp;&nbsp; Shell shell = new Shell(display);<BR><BR>&nbsp;&nbsp;&nbsp; Text text = new Text(shell, SWT.H_SCROLL|SWT.V_SCROLL);<BR><BR>&nbsp;&nbsp;&nbsp; int rows = 5, columns = 10;<BR><BR>&nbsp;&nbsp;&nbsp; GC gc = new GC(text);<BR><BR>&nbsp;&nbsp;&nbsp; FontMetrics fm = gc.getFontMetrics();<BR><BR>&nbsp;&nbsp;&nbsp; gc.dispose();<BR><BR>&nbsp;&nbsp;&nbsp; int height = rows * text.getLineHeight();<BR><BR>&nbsp;&nbsp;&nbsp; int width = columns * fm.getAverageCharWidth();<BR><BR>&nbsp;&nbsp;&nbsp; text.setSize(text.computeSize (width, height));<BR><BR>&nbsp;&nbsp;&nbsp; shell.pack();<BR><BR>&nbsp;&nbsp;&nbsp; shell.open();<BR><BR>&nbsp;&nbsp;&nbsp; while (!shell.isDisposed()) {<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!display.readAndDispatch()) display.sleep();<BR><BR>&nbsp;&nbsp;&nbsp; }<BR><BR>&nbsp;&nbsp;&nbsp; display.dispose();<BR><BR>&nbsp; }<BR><BR><BR><STRONG>&nbsp;Line Delimiters<BR></STRONG>行定义符号<BR><BR><BR><BR><BR><BR><BR><BR></SPAN><BR><BR><img src ="http://www.blogjava.net/fortune/aggbug/35074.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-13 16:30 <a href="http://www.blogjava.net/fortune/archive/2006/03/13/35074.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Basic Controls -- Button</title><link>http://www.blogjava.net/fortune/archive/2006/03/13/35062.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Mon, 13 Mar 2006 08:11:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/13/35062.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/35062.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/13/35062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/35062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/35062.html</trackback:ping><description><![CDATA[<P class=docText><SPAN class=docEmphStrong><SPAN class=docEmphStrong><STRONG>Button Hierarchy</STRONG><BR><BR><IMG height=53 alt=graphics/07inf05.gif src="mk:@MSITStore:E:\java学习资料\swt教程\Addison.Wesley.Professional.SWT.The.Standard.Widget.Toolkit.Volume.1.Jun.2004.eBook-DDU.chm::/0321256638/images/0321256638/graphics/07inf05.gif" width=119 border=0><BR><BR><BR><STRONG>Button Styles<BR></STRONG><BR></P></SPAN>
<P class=docText>
<TABLE cellSpacing=0 cellPadding=4 rules=rows frame=hsides>
<TBODY>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.ARROW</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Draw an arrow instead of text or an image 将button的形状显示为箭头</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.CHECK</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Create a check button </P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.PUSH</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Create a push button</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.RADIO</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Create a radio button</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.TOGGLE</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Create a toggle button</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.FLAT</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Draw the button with a flat look&nbsp; 使button看起来是flat的</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.UP</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Draw an up arrow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 箭头向上（arrow时才有效）</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.DOWN</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Draw a down arrow&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箭头向下（arrow时有效）</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.LEFT</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Left-align the button (or draw a left arrow)文字向左对齐或箭头向左（arrow时）</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.RIGHT</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Right-align the button (or draw a right arrow)文字向右对齐或箭头向右（arrow时）</P></TD></TR>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.CENTER</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>Center align the button&nbsp; button上的文字中间对齐</P></TD></TR></TBODY></TABLE></P>
<P class=docText><BR></SPAN><BR><STRONG>Button Events</STRONG><BR><BR></P>
<P class=docText>
<TABLE cellSpacing=0 cellPadding=4 rules=rows frame=hsides>
<TBODY>
<TR>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>SWT.Selection</P></TD>
<TD class=docTableCell vAlign=top align=left>
<P class=docText>&nbsp;&nbsp;&nbsp;The button was selected&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; button被选中事件</P></TD></TR></TBODY></TABLE></P>
<P class=docText>&nbsp;<BR>button是活动控件，当用户点击他们会发送事件<BR><BR><STRONG>Text and Images</STRONG><BR><BR>button支持显示文本和图像，它的使用大体上与label相同，但是它不支持SWT.WARP和换行符，既button上的文本字符只能是一行，而且它能只能显示文本或图像中的一种不能同时都显示</P>
<P class=docText><SPAN class=docEmphStrong>setText(String string)</SPAN> <BR><SPAN class=docEmphStrong>getText()</SPAN> <BR><SPAN class=docEmphStrong>setImage(Image image)</SPAN> <BR><SPAN class=docEmphStrong>getImage()</SPAN> </P>
<P class=docText>尽管button支持图片显示但是通常不这么使用，一般使用Tool bars 来代替<BR><BR><STRONG>Alignment</STRONG><BR><BR><SPAN class=docEmphStrong>setAlignment(int alignment)</SPAN>&nbsp;&nbsp; 设置对齐方式&nbsp; SWT.LEFT, SWT.CENTER, or SWT.RIGHT中的一种<BR><SPAN class=docEmphStrong>getAlignment()</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 返回对齐方式<BR><BR>通常很少使用这2个函数，因为默认的对齐一般都很好<BR><BR><STRONG>Push Buttons</STRONG><BR><BR>SWT.PUSH，它们通常用来产生一个动作，与其它类型的button不同push&nbsp; button不会在 SWT.Selection 事件中保持选中或未选中状态。它们通常被认为是未选中。<BR>Button button = new Button(parent, SWT.PUSH);<BR>button.setText("Ok");<BR><BR><STRONG>Check Buttons</STRONG><BR><BR>SWT.CHECK。它与push&nbsp; button不同的是它会保持一个选中的状态，用户使用鼠标或者键盘选择这个状态<BR><BR>你可以使用方法设置check&nbsp; button的选中状态<BR><SPAN class=docEmphStrong>setSelection(boolean selection)&nbsp; 设置该button为选中状态check, radio, or toggle button时有效<BR><SPAN class=docEmphStrong>getSelection()</SPAN> 返回该button是否被选中<BR><BR>Button button = new Button(parent, SWT.CHECK);<BR>button.setText("Overwrite when typing");<BR>button.setSelection(true);<BR><BR>注意：调用&nbsp;setSelection() 不会产生一个SWT.Selection 事件，SWT的编程新手经常会对这个感到很困惑。<BR><BR>当用户点击一个check，就会触发一个动作事件。你可以设置动作监听器<BR><BR>ActionListener listener =....<BR>bold.addActionListener(listener);<BR>italic.addActionListener(listener);<BR>监听器的actionPerformed方法将查询bold和italic两个check&nbsp; button的状态并且相应地把面板中的字体设为普通、加粗、倾斜以及后两种组合。<BR>public void actionPerformed(ActionEvent event)<BR>{<BR>&nbsp;&nbsp;&nbsp;int mode = 0;<BR>&nbsp;&nbsp;&nbsp;if (bold.isSelected()) mode +=Font.BOLD;<BR>&nbsp;&nbsp;&nbsp;if (italic.isSelected()) mode += Font.ITALIC;<BR>&nbsp;&nbsp;&nbsp;label.setFont(new Font("Serif", mode, FONTSIZE));<BR>}<BR><BR><STRONG>Radio Buttons</STRONG><BR><BR>SWT.RADIO 与check&nbsp; button一样它们会保持一个布尔状态，但是当多个radio&nbsp; button都是属于一个parent时，一次只能有一个被选中<BR></SPAN>Button button1 = new Button(parent, SWT.RADIO);<BR>button1.setText("Don't wrap");<BR>button1.setSelection(true);<BR>Button button2 = new Button(parent, SWT.RADIO);<BR>button2.setText("Wrap to window");<BR>Button button3 = new Button(parent, SWT.RADIO);<BR>button3.setText("Wrap to ruler");<BR><BR><BR><STRONG>Toggle Buttons</STRONG><BR><BR>SWT.TOGGLE&nbsp;&nbsp;&nbsp; toggle&nbsp; button是当被选中时一直停留在pressed状态下的push&nbsp; button<BR><BR><BR><STRONG>Arrow Buttons</STRONG><BR>SWT.ARROW<BR>Button button = new Button(parent, SWT.ARROW);<BR>button.setAlignment(SWT.RIGHT);<BR><BR>arrow&nbsp; button主要用于显示“上一页”或“下一页”时使用<BR><BR><STRONG>Button Events</STRONG><BR><BR><STRONG>SWT.Selection (SelectionEvent)</STRONG><BR><BR>button.addListener(SWT.Selection, new Listener() {<BR><BR>&nbsp;&nbsp;&nbsp; public void handleEvent(Event event) {<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Ok Pressed");<BR><BR>}<BR><BR>});<BR><BR><STRONG>Using SWT.Selection with Radio Buttons</STRONG><BR><BR>SWT.Selection 很少与radio一起使用，与check button一样，它们通常使用于对话框，对于绝大多数的操作系统，程序不会产生一个action直到dialog被关闭<BR>令人意外的是当用户在一组radio button中选择一个radio时，2个SWT.Selection 事件被发送：前一个被选中的radio button接收到一个 SWT.Selection 事件通知它的选中状态改为false，新的被选中的radio button接收到一个 SWT.Selection事件通知它已被选中<BR><BR>Listener listener = new Listener() {<BR>&nbsp;&nbsp;&nbsp; public void handleEvent(Event event) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Button button = (Button) event.widget;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!button.getSelection()) return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Arriving " + button.getText());<BR>&nbsp;&nbsp;&nbsp; }<BR>};<BR>Button land = new Button(shell, SWT.RADIO);<BR>land.setText("By Land");<BR>land.addListener(SWT.Selection, listener);<BR>Button sea = new Button(shell, SWT.RADIO);<BR>sea.setText("By Sea");<BR>sea.addListener(SWT.Selection, listener);<BR>sea.setSelection(true);<BR><BR><BR><BR><BR><BR><BR></P><img src ="http://www.blogjava.net/fortune/aggbug/35062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-13 16:11 <a href="http://www.blogjava.net/fortune/archive/2006/03/13/35062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Basic Controls -- Label</title><link>http://www.blogjava.net/fortune/archive/2006/03/13/35026.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Mon, 13 Mar 2006 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/13/35026.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/35026.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/13/35026.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/35026.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/35026.html</trackback:ping><description><![CDATA[<STRONG>&nbsp;Label Hierarchy<BR><BR><IMG height=52 alt=graphics/07inf02.gif src="mk:@MSITStore:E:\java学习资料\swt教程\Addison.Wesley.Professional.SWT.The.Standard.Widget.Toolkit.Volume.1.Jun.2004.eBook-DDU.chm::/0321256638/images/0321256638/graphics/07inf02.gif" width=111 border=0><BR><BR>Label Styles</STRONG><BR><BR>
<P class=docText>SWT.WRAP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;自动调整label中的内容行以适应可见区域的大小（既label内容自动换行）<BR>SWT.LEFT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label内容左对齐<BR>SWT.CENTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label内容中间对齐<BR>SWT.RIGHT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label内容右对齐<BR>SWT.SEPARATOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;画一个分割符<BR>SWT.HORIZONTAL&nbsp;&nbsp;&nbsp;使分割符水平（仅在画分割符时使用）<BR>SWT.VERTICAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使分割符垂直（仅在画分割符时使用）<BR>SWT.SHADOW_IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使分割符有“SHADOW_IN&nbsp;”的效果（仅在画分割符时使用）<BR>SWT.SHADOW_OUT&nbsp;&nbsp;使分割符有“SHADOW_OUT”的效果&nbsp;（仅在画分割符时使用）</P>
<P class=docText><STRONG>Label Events (none)</STRONG><BR><BR>label是一个静态组件可用来放置文本，图像，分隔符，一个静态的控件既不含有焦点（focus）也不参与tab traversal，鼠标点击不产生任何影响<BR><BR>Label label = new Label(parent, SWT.NONE);<BR>label.setText("User Name:");<BR><BR><STRONG>Text and Images</STRONG><BR><BR>label允许你设置文本或图像在上面如果你什么都不设置则label显示的是background color<BR><SPAN class=docEmphStrong><BR>setText(String string)&nbsp;&nbsp;&nbsp; 设置label显示文本内容string<BR><SPAN class=docEmphStrong>getText()</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 返回label的文本内容<BR><SPAN class=docEmphStrong>setImage(Image image) 设置label显示的图像<BR></SPAN><SPAN class=docEmphStrong>getImage()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回图像<BR><BR>注意：文本和图像只能设置其中的一种，若你想在label上文本和图像都加入，你要使用CLabel<BR><BR></SPAN><BR></SPAN><BR><BR><BR><BR></P><img src ="http://www.blogjava.net/fortune/aggbug/35026.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-13 14:24 <a href="http://www.blogjava.net/fortune/archive/2006/03/13/35026.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于clone函数</title><link>http://www.blogjava.net/fortune/archive/2006/03/13/34986.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Mon, 13 Mar 2006 02:34:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/13/34986.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/34986.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/13/34986.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/34986.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/34986.html</trackback:ping><description><![CDATA[今天看core java看到了clone函数<BR>要想使用clone函数首先必须实现接口Cloneable，重新定义clone函数为公有的，并调用super.clone（）<BR><BR>class Employee implements Cloneable<BR>{<BR>&nbsp;&nbsp;&nbsp;public Object clone()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return super.clone();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (CloneNotSupportedException e) { return null; }<BR>}<BR>..........<BR>}<BR><BR>使用clone函数是要注意一个浅拷贝和深拷贝的问题，默认的拷贝操作都是浅拷贝——没有克隆对象内部引用的其他对象，所以要实现深拷贝，需要克隆可变实例字段需重建立clone方法<BR><BR>具体知识可参考core java章节--接口和内部类<img src ="http://www.blogjava.net/fortune/aggbug/34986.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-13 10:34 <a href="http://www.blogjava.net/fortune/archive/2006/03/13/34986.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Layout - FormLayout</title><link>http://www.blogjava.net/fortune/archive/2006/03/09/34463.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Thu, 09 Mar 2006 05:51:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/09/34463.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/34463.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/09/34463.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/34463.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/34463.html</trackback:ping><description><![CDATA[<SPAN lang=EN-US style="mso-ansi-language: EN-US">MarginWidth, MarginHeight<BR>离页边宽度和高度，与GridLayout中相似<BR><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white"><BR>Display display = <SPAN style="COLOR: navy">new</SPAN> Display ();<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">Shell shell = <SPAN style="COLOR: navy">new</SPAN> Shell (display);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">FormLayout layout= <SPAN style="COLOR: navy">new</SPAN> FormLayout ();<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">layout.marginHeight = 5;<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">layout.marginWidth = 5;<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">shell.setLayout (layout);</SPAN><BR><BR><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">FormData<BR>指定了每个widget在FormLayout中怎样排列<BR>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">很典型地，一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormData</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">实例在一个合成器内被帮定于各个子</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">。因为对于一个表格布局其核心思想就是指明各个子</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的相对位置，所以不同于其他的布局，给予各个子</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">提供设置用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">data</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">非常重要。如果一个给定的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">没有一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormData</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">实例来描述它，则它会被默认为放置于合成器的左上角，而这种位置是你极少期望的。宽度和高度属性用象素来指明一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的方位。顶部、底部和左右属性较为重要，且都持有一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">实例。这些</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">attachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">描绘了在一个合成器内</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">间的关系。<BR>注意：如果多个widgets未指明任何attachment，他们都会在缺省值指定的位置重叠起来<BR></SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">指明关系</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">理解</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">是使用表格布局的一个非常重要的方面。就像早先提起的，每一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">实例描述了一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">某一面的位置。你可以以两种不同的方式使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">首先，你可以使用父合成器的百分比来指明一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">。例如，如果一个左侧的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormData</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">被设定为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">50%</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">，则</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的右边际会处于合成器的水平中央。同样地，如果设定顶端边界为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">75%</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">则</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">会处于合成器自上而下的四分之三处。表</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">6.3</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">总结了用以指定百分比的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">构造器。以百分比的形式来指明</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">是有用的，但你不能总是应用这种方法。将你的所有</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">通用百分比方式作说明和用绝对的象素点来指明他们没有太大的区别：因为当合成器被重定大小时，如何快速定位每一个元素会变得相当困难，因为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">并不会如你所愿地在该位置上。使用表格式布局的关键点是在于确定</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">间的相互位置，而这正是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachement</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">所允许的。<BR><BR></SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ansi-language: EN-US; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">基于百分比</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-language: EN-US; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ansi-language: EN-US; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">构造器</SPAN><BR>
<TABLE class=MsoNormalTable style="BORDER-RIGHT: black 1pt outset; BORDER-TOP: black 1pt outset; BORDER-LEFT: black 1pt outset; WIDTH: 100%; BORDER-BOTTOM: black 1pt outset; mso-cellspacing: 0cm; mso-border-alt: outset black .75pt; mso-padding-alt: 0cm 0cm 0cm 0cm" cellSpacing=0 cellPadding=0 width="100%" border=1>
<THEAD>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 37%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="37%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">构造器</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 63%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="63%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">描述</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></THEAD>
<TBODY>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 37%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="37%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(int numerator)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 63%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="63%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">假定分母为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">100</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">，意味着参数即被视为一个百分比。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">仅在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT 3.0</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">中可用。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 37%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="37%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(int numerator, int offset)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 63%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="63%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">假定分母为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">100</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">，意味着参数即被视为一个百分比。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">偏移量</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">offset</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">是在百分比定位的基础上再行偏移的象素数目。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 37%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="37%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(int numerator, int denominator, int offset)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 63%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="63%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">假定分母为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><FONT size=3>denominator</FONT></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">，意味着参数即被视为一个百分比。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">偏移量</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">offset</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">是在百分比定位的基础上再行偏移的象素数目。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE><BR>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第二系列的构造器是基于对其他</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的参照。它们常常将一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的边缘与相邻的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">相对定位。通过为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">button1</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">设定</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormData</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">右属性到一个基于</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">button2</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">而构建的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">，你可以说</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">button1</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">应该总是定位与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">button2</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的右侧。将你的绝大多数</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">依照这种方式去定位有多种好处。你的布局代码目的就变得很容易理解：在过去的象素或是百分壁基础上的那个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">与哪个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">相邻的表达方式被取代后，就变得很明显了，例如：名为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">foo</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">应该位于工具条之下；其次，表格式布局也容易维持你的这种布局意图。无论合成器的尺寸如何大小变化，它总是能够维持其正确的相对位置。<BR></P>
<P class=Code style="MARGIN-LEFT: 18pt"><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">FormData formData = <SPAN style="COLOR: navy">new</SPAN> FormData();<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">formData.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(30,70,10);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-ansi-language: EN-US; mso-highlight: white">button1.setLayoutData(formData);</SPAN><BR>指的是加入该Composite含有70个单元则该button1的顶部位于Composite从上数30个单元再加10个像素的位移<BR><BR><BR><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ansi-language: EN-US; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">作为指定相对位置之用的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-language: EN-US; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">FormAttachment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ansi-language: EN-US; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">构造器有若干种形式，具体总结如下<BR>：</SPAN><BR></SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<TABLE class=MsoNormalTable style="BORDER-RIGHT: black 1pt outset; BORDER-TOP: black 1pt outset; BORDER-LEFT: black 1pt outset; WIDTH: 100%; BORDER-BOTTOM: black 1pt outset; mso-cellspacing: 0cm; mso-border-alt: outset black .75pt; mso-padding-alt: 0cm 0cm 0cm 0cm" cellSpacing=0 cellPadding=0 width="100%" border=1>
<THEAD>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 39%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="39%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">构造器</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 61%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="61%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">描述</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></THEAD>
<TBODY>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 39%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="39%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(Control control)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 61%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="61%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">将现有小部件添于邻接的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">一侧的参数。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 39%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="39%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(Control control, int offset)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 61%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="61%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">将现有小部件添于邻接的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">一侧的参数，并且有</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">offset</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">数量象素的偏移量。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 39%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="39%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FormAttachment(Control control, int offset, int alignment)</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 61%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="61%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">排列</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">alignment</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">必须为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> SWT.TOP</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> SWT.BOTTOM</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.LEFT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> SWT.RIGHT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">或</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.CENTER</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">其中之一。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">将现有小部件添于邻接的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">一侧的参数，并且有</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">offset</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">数量象素的偏移量。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE><BR>注意：对于top和left的offset应该为正数，对于bottom和right的offset应该为负数<BR><BR><BR>相对于另一个 widget进行定位<BR><BR>FormData formData = <SPAN style="COLOR: navy">new</SPAN> FormData();<BR><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">formData.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(20,0);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">button1.setLayoutData(formData);</SPAN><SPAN lang=EN-US>&nbsp;<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">FormData formData2 = <SPAN style="COLOR: navy">new</SPAN> FormData();<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">formData2.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(button1,10);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">button2.setLayoutData(formData2);<BR><BR>上面这段代码的意思就是首先将button1顶部放置在距离Composite顶部20%处，然后将button2的顶部放置在button1下10个像素位移处，当窗口大小改变时，button1会一直随着改变并处于20%处，而button2也一直在button1下方10个像素处<BR><BR><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">formData2.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(button1,0,SWT.TOP);<o:p> 指定button2的顶部和button1相同也处于20%处<BR><BR><BR>
<P class=Code style="MARGIN-LEFT: 36pt; tab-stops: 18.0pt 36.0pt 2.0cm 72.0pt 3.0cm 99.25pt 126.0pt 144.0pt 162.0pt 180.0pt 198.0pt 216.0pt 234.0pt 252.0pt 270.0pt 288.0pt 306.0pt 324.0pt 342.0pt 360.0pt 378.0pt 396.0pt 414.0pt"><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">FormData formData = <SPAN style="COLOR: navy">new</SPAN> FormData(50,50);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">formData.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(20,0);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">button1.setLayoutData(formData);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">FormData formData2 = <SPAN style="COLOR: navy">new</SPAN> FormData();<BR></SPAN><SPAN lang=EN-US>FormData2.left = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(button1,5);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">formData2.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(button1,0,SWT.TOP);<BR></SPAN><SPAN lang=EN-US style="BACKGROUND: white; mso-highlight: white">button2.setLayoutData(formData2);</SPAN></P>上面的代码说明button1大小为50*50像素，距离顶部20%，button2的左边与button1距离差5个像素，顶部与button1相同<BR><SPAN style="BACKGROUND: white; mso-highlight: white">若将上面改为formData.top = <SPAN style="COLOR: navy">new</SPAN> FormAttachment(button1,0,SWT.CENTER);则button2在button1左边5个像素处且在垂直方向上处于button1的中间<BR><BR>注意：千万不要定义重复的attachment，如定义button2的左边连着button1的右边，又定义button1的右边连着button2的左边，这样会导致未定义错误，所以一定要确定你的weidget没有重复限制他们的位置，仅定义 需要限制位置的widget</SPAN><BR><BR><BR>参考：<A href="http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm">http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm</A><BR><BR><BR><BR><BR><BR><BR><BR><BR></o:p></SPAN><BR><BR><BR><BR><BR><BR><BR><BR></SPAN><BR><BR></SPAN></SPAN><img src ="http://www.blogjava.net/fortune/aggbug/34463.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-09 13:51 <a href="http://www.blogjava.net/fortune/archive/2006/03/09/34463.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Layout - RowLayout</title><link>http://www.blogjava.net/fortune/archive/2006/03/08/34328.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 08 Mar 2006 11:01:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/08/34328.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/34328.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/08/34328.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/34328.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/34328.html</trackback:ping><description><![CDATA[RowLayout要比FillLayout使用多些，每个widget的长度和宽度都可以通过方法setLayout（）设定widget的RowData。<BR><BR>Type域<BR>指定按行或列排列&nbsp;&nbsp;如：&nbsp;new RowLayout(SWT.HORIZONTAL);default：horizontal<BR><BR>Wrap域<BR>指定该行或列空间不足放下当前控件时是否自动换行；default：true<BR><BR>Pack域<BR>指定Layout中的widgets是否采用它们的自然大小，如果pack为false则所有widget强制为相同大小default：true<BR><BR>Justify域<BR>true表明Layout中的所有widgets每行都从左到右平均距离展开default：false<BR>
<H4><A name=_Toc509864533><SPAN lang=EN-US style="mso-ansi-language: EN-US">MarginLeft, MarginTop, MarginRight, MarginBottom and Spacing</SPAN></A></H4>
<H4>前面4个是指定于边框距离的，spacing指定widget之间的间隔</H4>
<H4><SPAN lang=EN-US style="mso-ansi-language: EN-US"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;&nbsp; RowLayout rowLayout = <SPAN style="COLOR: navy">new</SPAN> RowLayout();</o:p></SPAN></H4>
<H4><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.wrap = false;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.pack = false;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.justify = true;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.type = SWT.VERTICAL;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.marginLeft = 5;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.marginTop = 5;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.marginRight = 5;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.marginBottom = 5;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>rowLayout.spacing = 0;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>shell.setLayout(rowLayout)</SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN>&nbsp;</H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">下面的代码使用RowData对象来改变button的大小</SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">
<P class=Code><SPAN lang=EN-US style="COLOR: navy; mso-ansi-language: EN-US">import</SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"> org.eclipse.swt.*;<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="COLOR: navy; mso-ansi-language: EN-US">import</SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"> org.eclipse.swt.widgets.*;<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="COLOR: navy; mso-ansi-language: EN-US">import</SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"> org.eclipse.swt.layout.*;<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">&nbsp;<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="COLOR: navy; mso-ansi-language: EN-US">public</SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"> <SPAN style="COLOR: navy">class</SPAN> RowDataExample {<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">&nbsp;<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">public</SPAN> <SPAN style="COLOR: navy">static</SPAN> <SPAN style="COLOR: navy">void</SPAN> main(String[] args) {<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Display display = <SPAN style="COLOR: navy">new</SPAN> Display();<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Shell shell = <SPAN style="COLOR: navy">new</SPAN> Shell(display);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.setLayout(<SPAN style="COLOR: navy">new</SPAN> RowLayout());<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Button button1 = <SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button1.setText(<SPAN style="COLOR: teal">"Button 1"</SPAN>);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button1.setLayoutData(<SPAN style="COLOR: navy">new</SPAN> RowData(50, 40));<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Button button2 = <SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button2.setText(<SPAN style="COLOR: teal">"Button 2"</SPAN>);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button2.setLayoutData(<SPAN style="COLOR: navy">new</SPAN> RowData(50, 30));<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Button button3 = <SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button3.setText(<SPAN style="COLOR: teal">"Button 3"</SPAN>);<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button3.setLayoutData(<SPAN style="COLOR: navy">new</SPAN> RowData(50, 20));<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.pack();<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>shell.open();<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">while</SPAN> (!shell.isDisposed()) {<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">if</SPAN> (!display.readAndDispatch()) display.sleep();<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">}</SPAN></P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN>&nbsp;</P>
<P class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">参考：<A href="http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm">http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm</A><o:p></o:p></SPAN></P></SPAN></H4></o:p></SPAN><img src ="http://www.blogjava.net/fortune/aggbug/34328.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-08 19:01 <a href="http://www.blogjava.net/fortune/archive/2006/03/08/34328.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Layout-FillLayout</title><link>http://www.blogjava.net/fortune/archive/2006/03/08/34303.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 08 Mar 2006 09:17:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/08/34303.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/34303.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/08/34303.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/34303.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/34303.html</trackback:ping><description><![CDATA[<P>下图是SWT中的一些术语说明<BR><BR><BR><IMG height=296 src="http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts_files/image001.png" width=520 border=0><BR><BR>SWT共有4种Layout：FillLayout，RowLayout，GridLayout，FormLayout<BR><BR>FillLayout<BR>FillLayout是最简单的Layout，它将widgets放在单行或单列上，强制使它们具有相同的大小，也就是说每个widget的高度和宽度都和其中最高或最宽的那个widget一样<BR><A href="http://help.eclipse.org/help31/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/FillLayout.html#marginHeight"><STRONG><FONT face="Courier New">marginHeight</FONT></STRONG></A> （与上下边框的距离），<A href="http://help.eclipse.org/help31/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/FillLayout.html#marginWidth"><STRONG><FONT face="Courier New" color=#002c99>marginWidth</FONT></STRONG></A> （与左右边框的距离）（since3.0）<BR><BR><BR>spacing，指定widgets之间的间隔距离（since3.0）<BR><BR>public class Snippet172 {<BR>&nbsp;public static void main (String [] args) {<BR>&nbsp;&nbsp;Display display = new Display ();<BR>&nbsp;&nbsp;Shell shell = new Shell (display);<BR>&nbsp;&nbsp;FillLayout fillLayout = new FillLayout ();<BR>&nbsp;&nbsp;fillLayout.type = SWT.VERTICAL;<BR>&nbsp;&nbsp;fillLayout.marginHeight = 20;<BR>&nbsp;&nbsp;fillLayout.marginWidth = 15;<BR>&nbsp;&nbsp;fillLayout.spacing = 10;<BR>&nbsp;&nbsp;shell.setLayout (fillLayout);</P>
<P>&nbsp;&nbsp;Button button0 = new Button (shell, SWT.PUSH);<BR>&nbsp;&nbsp;button0.setText ("button0");</P>
<P>&nbsp;&nbsp;Button button1 = new Button (shell, SWT.PUSH);<BR>&nbsp;&nbsp;button1.setText ("button1");</P>
<P>&nbsp;&nbsp;Button button2 = new Button (shell, SWT.PUSH);<BR>&nbsp;&nbsp;button2.setText ("button2");</P>
<P>&nbsp;&nbsp;shell.pack ();<BR>&nbsp;&nbsp;shell.open ();</P>
<P>&nbsp;&nbsp;while (!shell.isDisposed ()) {<BR>&nbsp;&nbsp;&nbsp;if (!display.readAndDispatch ())<BR>&nbsp;&nbsp;&nbsp;&nbsp;display.sleep ();<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;display.dispose ();<BR>&nbsp;}<BR>}<BR><BR>参考：<A href="http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm">http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm</A><BR></P><img src ="http://www.blogjava.net/fortune/aggbug/34303.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-08 17:17 <a href="http://www.blogjava.net/fortune/archive/2006/03/08/34303.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT Layout--GridLayout</title><link>http://www.blogjava.net/fortune/archive/2006/03/08/34267.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 08 Mar 2006 06:34:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/03/08/34267.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/34267.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/03/08/34267.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/34267.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/34267.html</trackback:ping><description><![CDATA[<H4><A name=_Toc509864538><SPAN lang=EN-US style="mso-ansi-language: EN-US">NumColumns</SPAN></A><FONT color=#000000>(列数)是GridLayout中最重要的域，它将Composite划分成NumColumns列，往上添加控件时依次从左至右排列当控件数多于列数时换行</FONT></H4>
<P>Display display = <SPAN style="COLOR: navy">new</SPAN> Display();<BR><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>Shell shell = <SPAN style="COLOR: navy">new</SPAN> Shell(display);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>GridLayout gridLayout = <SPAN style="COLOR: navy">new</SPAN> GridLayout();<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>gridLayout.numColumns = 3;<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>shell.setLayout(gridLayout);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH).setText(<SPAN style="COLOR: teal">"B1"</SPAN>);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH).setText(<SPAN style="COLOR: teal">"Wide Button 2"</SPAN>);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH).setText(<SPAN style="COLOR: teal">"Button 3"</SPAN>);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH).setText(<SPAN style="COLOR: teal">"B4"</SPAN>);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">new</SPAN> Button(shell, SWT.PUSH).setText(<SPAN style="COLOR: teal">"Button 5"</SPAN>);<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>shell.pack();<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>shell.open();<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">while</SPAN> (!shell.isDisposed()) {<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: navy">if</SPAN> (!display.readAndDispatch()) display.sleep();<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>}<BR><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><A name=_Toc509864539><SPAN lang=EN-US style="mso-ansi-language: EN-US"><STRONG>MakeColumnsEqualWidth<BR></STRONG></SPAN></A>使每列的宽度相同，默认值为false<BR><BR><A name=_Toc509864540><SPAN lang=EN-US style="mso-ansi-language: EN-US"><STRONG>MarginWidth, MarginHeight, HorizontalSpacing, and VerticalSpacing</STRONG></SPAN></A><BR>页边宽度，页边高度，水平间隔，垂直间隔<BR><BR><STRONG>GridData<BR></STRONG>GridData是控制小部件布局的对象，例如<BR>&nbsp;&nbsp; GridData gridData = <SPAN style="COLOR: navy">new</SPAN> GridData();<BR><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>gridData.horizontalAlignment = GridData.FILL;//horizontalAlignment是指水平对齐方式<BR>//（有GEGINING，END，CENTRE，FILL）<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>gridData.grabExcessHorizontalSpace = true;<BR></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>button1.setLayoutData(gridData);<BR><o:p>注意：每个在GridLayout中的widget都有一个自己的GridData，如果没有为它设置则系统会给他一个默认的GridData！<BR></P>
<H4><A name=_Toc509864542><SPAN lang=EN-US style="mso-ansi-language: EN-US">HorizontalAlignment and VerticalAlignment</SPAN></A><SPAN lang=EN-US style="mso-ansi-language: EN-US"> </SPAN></H4>
<H4><SPAN lang=EN-US style="mso-ansi-language: EN-US">每个alignment域指定控件在它的格子单元内水平/垂直怎样对齐，他们是下面4个值中的一个</SPAN></H4>
<H4><SPAN lang=EN-US style="mso-ansi-language: EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN lang=EN-US style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">BEGINNING（左对齐）</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">CENTER（中间对齐）</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">END右对齐</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">FILL充满格子</SPAN></H4></SPAN>
<H4><SPAN lang=EN-US style="mso-ansi-language: EN-US">缺省值为horizontalAlignment is BEGINNING&nbsp;， verticalAlignment is CENTER</SPAN></H4><SPAN lang=EN-US style="mso-ansi-language: EN-US">
<H4><A name=_Toc509864543><SPAN lang=EN-US style="mso-ansi-language: EN-US">HorizontalIndent</SPAN></A></H4>
<H4 align=justify>允许你将widget向右移动指定的像素位</H4>
<H4 align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p><SPAN lang=EN-US style="mso-ansi-language: EN-US">GridData gridData = <SPAN style="COLOR: navy">new</SPAN> GridData();</SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US">gridData.horizontalIndent = 4;<o:p></o:p></SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US">button.setLayoutData(gridData);</SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p><A name=_Toc509864544><SPAN lang=EN-US style="mso-ansi-language: EN-US">HorizontalSpan and VerticalSpan</SPAN></A></o:p></SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p>span域可使widget占据多个grid单元（仅在horizontalAlignment为Fill时有效）</o:p></SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p><SPAN lang=EN-US style="mso-ansi-language: EN-US">GridData gridData = <SPAN style="COLOR: navy">new</SPAN> GridData();<o:p></o:p></SPAN></H4>
<H4 class=Code style="MARGIN-LEFT: 18pt" align=justify>
<P class=Code style="MARGIN-LEFT: 18pt"><SPAN lang=EN-US style="mso-ansi-language: EN-US">gridData.horizontalAlignment = GridData.FILL;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; mso-ansi-language: EN-US"> </SPAN><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p></o:p></SPAN></P>
<P class=Code style="MARGIN-LEFT: 18pt"><SPAN lang=EN-US style="mso-ansi-language: EN-US">gridData.horizontalSpan = 2;<o:p></o:p></SPAN></P>
<P class=Code style="MARGIN-LEFT: 18pt"><SPAN lang=EN-US style="mso-ansi-language: EN-US">button5.setLayoutData(gridData);</SPAN></P></o:p></SPAN></H4>
<H4 class=MsoNormal align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US">&nbsp;也可以它在垂直方向占用多个grid单元（仅在verticalAlignment为Fill时有效）</SPAN></H4>
<H4 class=MsoNormal align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US">注意：假如所有的widgets总共只有x行则你想让它在垂直方向占有x+1个grid单元是没有作用的</SPAN></H4>
<H4 class=MsoNormal align=justify><SPAN lang=EN-US style="mso-ansi-language: EN-US">
<H4 style="tab-stops: 90.0pt"><A name=_Toc509864545><SPAN lang=EN-US style="mso-ansi-language: EN-US">GrabExcessHorizontalSpace and GrabExcessVerticalSpace</SPAN></A></H4>
<H4 style="tab-stops: 90.0pt"><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p>当用户改变窗口大小时，<A name=_Toc509864545><SPAN lang=EN-US style="mso-ansi-language: EN-US">GrabExcessHorizontalSpace 和GrabExcessVerticalSpace</SPAN></A>指定该控件是否填充增大的空间</o:p></SPAN></H4>
<H4 style="tab-stops: 90.0pt"><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p><SPAN lang=EN-US style="mso-ansi-language: EN-US"><o:p>
<H4><A name=_Toc509864546><SPAN lang=EN-US style="mso-ansi-language: EN-US">WidthHint and HeightHint</SPAN></A></H4>
<H4>指定widget的大小（如果horizontalAlignment或verticalAlignment为FILL的时候就没有意义了）</H4>
<H4>GridData gridData = <SPAN style="COLOR: navy">new</SPAN> GridData();<o:p></o:p></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>gridData.widthHint = 70;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>gridData.heightHint = 40;<o:p></o:p></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>button5.setLayoutData(gridData);</SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">注：最好不要对大小硬编码</SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN>&nbsp;</H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">
<TABLE class=MsoNormalTable style="BORDER-RIGHT: black 1pt outset; BORDER-TOP: black 1pt outset; BORDER-LEFT: black 1pt outset; WIDTH: 100%; BORDER-BOTTOM: black 1pt outset; mso-cellspacing: 0cm; mso-border-alt: outset black .75pt; mso-padding-alt: 0cm 0cm 0cm 0cm" cellSpacing=0 cellPadding=0 width="100%" border=1>
<THEAD>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">Style </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">常量</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">描述</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></THEAD>
<TBODY>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FILL_HORIZONTAL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">扩展单元来水平地充满任何空余空间。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">指</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HORIZONTAL_ALIGN_FILL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FILL_VERTICAL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">扩展单元来垂直地充满任何空余空间。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">指</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">VERTICAL_ALIGN_FILL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FILL_BOTH</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">水平和垂直地扩展单元空间。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">等价于</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">FILL_HORIZONTAL | FILL_VERTICAL.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HORIZONTAL_ALIGN_BEGINNING</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">居左排列单元内容。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 5">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HORIZONTAL_ALIGN_END</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">居右排列单元内容。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 6">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HORIZONTAL_ALIGN_CENTER</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">水平居中排列单元内容。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 7">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HORIZONTAL_ALIGN_FILL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">扩展单元空间充满单元内水平空余空间。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 8">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">VERTICAL_ALIGN_BEGINNING</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">排列单元内容于单元顶部。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 9">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">VERTICAL_ALIGN_END</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">排列单元内容于单元底部。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 10">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">VERTICAL_ALIGN_CENTER</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">排列单元内容于垂直中央。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 11; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 29%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="29%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">VERTICAL_ALIGN_FILL</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 71%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="71%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">扩展单元空间充满单元内垂直空余空间。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN>&nbsp;</H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: center; mso-pagination: widow-orphan" align=center><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">Table 6.2 GridData </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">尺寸属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P>
<TABLE class=MsoNormalTable style="BORDER-RIGHT: black 1pt outset; BORDER-TOP: black 1pt outset; BORDER-LEFT: black 1pt outset; WIDTH: 100%; BORDER-BOTTOM: black 1pt outset; mso-cellspacing: 0cm; mso-border-alt: outset black .75pt; mso-padding-alt: 0cm 0cm 0cm 0cm" cellSpacing=0 cellPadding=0 width="100%" border=1>
<THEAD>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">属性</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">描述</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">默认值</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></THEAD>
<TBODY>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">widthHint</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">列的最小宽度。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.DEFAULT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">指明了没有最小宽度。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.DEFAULT</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">heightHint</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">行的最小高度。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.DEFAULT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">指明了没有最小高度。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">SWT.DEFAULT</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">horizontalIndent</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">单元左侧边际与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">control</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">之间的象素间隙数量。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">0</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">horizontalSpan</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">单元所覆盖的网格的列的数目。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">1</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 5; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 21%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="21%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">verticalSpan</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 64%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="64%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">单元所覆盖的网格的行的数目。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: black 1pt inset; PADDING-RIGHT: 0cm; BORDER-TOP: black 1pt inset; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: black 1pt inset; WIDTH: 15%; PADDING-TOP: 0cm; BORDER-BOTTOM: black 1pt inset; BACKGROUND-COLOR: transparent; mso-border-alt: inset black .75pt" vAlign=top width="15%">
<P class=MsoNormal style="MARGIN: 4.5pt 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">1</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE></SPAN></H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US"></SPAN>&nbsp;</H4>
<H4 class=Code><SPAN lang=EN-US style="mso-ansi-language: EN-US">参考：<A href="http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm">http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm</A><o:p></o:p></SPAN></H4></o:p></SPAN></o:p></SPAN></SPAN></H4></H4></o:p></SPAN></SPAN></o:p></SPAN></o:p></SPAN><img src ="http://www.blogjava.net/fortune/aggbug/34267.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-03-08 14:34 <a href="http://www.blogjava.net/fortune/archive/2006/03/08/34267.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于Resource的Disposal </title><link>http://www.blogjava.net/fortune/archive/2006/02/23/32108.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Thu, 23 Feb 2006 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/02/23/32108.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/32108.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/02/23/32108.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/32108.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/32108.html</trackback:ping><description><![CDATA[<FONT size=2><BR>1、如果你用构造函数创建了widget或者graphic对象，当你不需要时你必须手动地dispose掉它;<BR>2、如果你不是使用构造函数得到这个widget或者graphic对象，由于不是你allocate的，你不需要手动来dispose掉它;<BR>3、如果你传递一个widget或者graphic对象的reference给另一个对象，那么你必须小心，不要在它仍在被使用中就dispose掉它;<BR>4、当你close掉一个shell，那么这个shell及其子widget会被递归dispose掉的，虽然你不需再dispose掉那些widget，但是你必须free掉与这些widget相关的图像资源;<BR>5、如果在一个widget的生命期中创建了graphic对象，可以通过注册一个dispose listener来free这个graphic对象，不过数据对象如Rectangle和Point没有使用操作系统资源，不用手动dispose(它们也没有dispose方法). </FONT><BR><img src ="http://www.blogjava.net/fortune/aggbug/32108.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-02-23 15:40 <a href="http://www.blogjava.net/fortune/archive/2006/02/23/32108.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA开发者应该去的20几个英文网站 （转）</title><link>http://www.blogjava.net/fortune/archive/2006/02/23/32062.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Thu, 23 Feb 2006 01:51:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/02/23/32062.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/32062.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/02/23/32062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/32062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/32062.html</trackback:ping><description><![CDATA[<P>[http://www.javaalmanac.com] - Java开发者年鉴一书的在线版本. 要想快速查到某种Java技巧的用法及示例代码, 这是一个不错的去处. <BR>[http://www.onjava.com] - O'Reilly的Java网站. 每周都有新文章. <BR>[http://java.sun.com] - 官方的Java开发者网站 - 每周都有新文章发表. <BR>[http://www.developer.com/java] - 由Gamelan.com 维护的Java技术文章网站. <BR>[http://www.java.net] - Sun公司维护的一个Java社区网站. <BR>[http://www.builder.com] - Cnet的Builder.com网站 - 所有的技术文章, 以Java为主. <BR>[http://www.ibm.com/developerworks/java] - IBM的Developerworks技术网站; 这是其中的Java技术主页. <BR>[http://www.javaworld.com] - 最早的一个Java站点. 每周更新Java技术文章. <BR>[http://www.devx.com/java] - DevX维护的一个Java技术文章网站. <BR>[http://www.fawcette.com/javapro] - JavaPro在线杂志网站. <BR>[http://www.sys-con.com/java] - Java Developers Journal的在线杂志网站. <BR>[http://www.javadesktop.org] - 位于Java.net的一个Java桌面技术社区网站. <BR>[http://www.theserverside.com] - 这是一个讨论所有Java服务器端技术的网站. <BR>[http://www.jars.com] - 提供Java评论服务. 包括各种framework和应用程序. <BR>[http://www.jguru.com] - 一个非常棒的采用Q&amp;A形式的Java技术资源社区. <BR>[http://www.javaranch.com] - 一个论坛，得到Java问题答案的地方，初学者的好去处。 <BR>[http://www.ibiblio.org/javafaq/javafaq.html] - comp.lang.java的FAQ站点 - 收集了来自comp.lang.java新闻组的问题和答案的分类目录. <BR>http://java.sun.com/docs/books/tutorial/] - 来自SUN公司的官方Java指南 - 对于了解几乎所有的java技术特性非常有帮助. <BR>http://www.javablogs.com] - 互联网上最活跃的一个Java Blog网站. <BR>http://java.about.com/] - 来自About.com的Java新闻和技术文章网站.<BR><BR>另外：<A href="http://www.theserverside.com/">www.theserverside.com</A></P>
<P><A href="http://www.apache.org/">www.apache.org</A></P>
<P>http://sourceforge.net/ </P><img src ="http://www.blogjava.net/fortune/aggbug/32062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-02-23 09:51 <a href="http://www.blogjava.net/fortune/archive/2006/02/23/32062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个小SWT程序</title><link>http://www.blogjava.net/fortune/archive/2006/02/22/31952.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 22 Feb 2006 05:13:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/02/22/31952.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/31952.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/02/22/31952.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/31952.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/31952.html</trackback:ping><description><![CDATA[<P>以下程序运行后产生一个红色的小球在窗口来回弹，如在小球结束运动之前关闭窗口（shell）则产生：<BR><BR>Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed<BR>&nbsp;at org.eclipse.swt.SWT.error(SWT.java:2942)<BR>&nbsp;at org.eclipse.swt.SWT.error(SWT.java:2865)<BR>&nbsp;at org.eclipse.swt.SWT.error(SWT.java:2836)<BR>&nbsp;at org.eclipse.swt.widgets.Widget.error(Widget.java:395)<BR>&nbsp;at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:297)<BR>&nbsp;at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1104)<BR>&nbsp;at org.eclipse.swt.graphics.GC.&lt;init&gt;(GC.java:132)<BR>&nbsp;at org.eclipse.swt.graphics.GC.&lt;init&gt;(GC.java:99)<BR>&nbsp;at ballThread.clean(BounceBall.java:115)<BR>&nbsp;at ballThread$2.run(BounceBall.java:135)<BR>&nbsp;at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)<BR>&nbsp;at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)<BR>&nbsp;at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)<BR>&nbsp;at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)<BR>&nbsp;at org.eclipse.swt.widgets.Display.release(Display.java:2765)<BR>&nbsp;at org.eclipse.swt.graphics.Device.dispose(Device.java:261)<BR>&nbsp;at BounceBall.main(BounceBall.java:58)<BR><BR>原因应该是仍然在使用对象时将该对象清除了导致异常的产生，应该怎样改动程序呢？？思考中.........<BR><BR><BR>import org.eclipse.swt.graphics.GC;<BR>import org.eclipse.swt.graphics.Point;<BR>import org.eclipse.swt.graphics.Rectangle;<BR>import org.eclipse.swt.widgets.Shell;<BR>import org.eclipse.swt.widgets.Display;<BR>import org.eclipse.swt.widgets.Canvas;<BR>import org.eclipse.swt.SWT;<BR>import org.eclipse.swt.widgets.Button;<BR>import org.eclipse.swt.graphics.Color;</P>
<P>public class BounceBall {</P>
<P>&nbsp;private Shell sShell = null;&nbsp; //&nbsp; @jve:decl-index=0:visual-constraint="10,10"<BR>&nbsp;private Canvas canvas = null;<BR>&nbsp;private Button startButton = null;<BR>&nbsp;ballThread bt = null;<BR>&nbsp;Display display = null;</P>
<P>&nbsp;public BounceBall() {<BR>&nbsp;&nbsp;super();<BR>&nbsp;&nbsp;// TODO Auto-generated constructor stub<BR>//&nbsp;&nbsp;bt = new ballThread(canvas);<BR>&nbsp;&nbsp;display = Display.getDefault();<BR>&nbsp;}</P>
<P>&nbsp;/**<BR>&nbsp; * This method initializes canvas&nbsp;<BR>&nbsp; *<BR>&nbsp; */<BR>&nbsp;private void createCanvas() {<BR>&nbsp;&nbsp;canvas = new Canvas(sShell, SWT.NONE);<BR>&nbsp;&nbsp;canvas.setBackground(new Color(Display.getCurrent(), 0, 0, 255));<BR>&nbsp;&nbsp;canvas.setBounds(new org.eclipse.swt.graphics.Rectangle(26,14,527,242));<BR>&nbsp;}</P>
<P>&nbsp;/**<BR>&nbsp; * @param args<BR>&nbsp; */<BR>&nbsp;public static void main(String[] args) {<BR>&nbsp;&nbsp;// TODO Auto-generated method stub<BR>&nbsp;&nbsp;/* Before this is run, be sure to set up the launch configuration (Arguments-&gt;VM Arguments)<BR>&nbsp;&nbsp; * for the correct SWT library path in order to run with the SWT dlls. <BR>&nbsp;&nbsp; * The dlls are located in the SWT plugin jar.&nbsp; <BR>&nbsp;&nbsp; * For example, on Windows the Eclipse SWT 3.1 plugin jar is:<BR>&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; installation_directory\plugins\org.eclipse.swt.win32_3.1.0.jar<BR>&nbsp;&nbsp; */<BR>//&nbsp;&nbsp;Display display = Display.getDefault();<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;BounceBall thisClass = new BounceBall();<BR>&nbsp;&nbsp;thisClass.createSShell();<BR>&nbsp;&nbsp;thisClass.sShell.open();</P>
<P>&nbsp;&nbsp;while (!thisClass.sShell.isDisposed()) {<BR>&nbsp;&nbsp;&nbsp;if (!thisClass.display.readAndDispatch())<BR>&nbsp;&nbsp;&nbsp;&nbsp;thisClass.display.sleep();<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;thisClass.display.dispose();<BR>&nbsp;}</P>
<P>&nbsp;/**<BR>&nbsp; * This method initializes sShell<BR>&nbsp; */<BR>&nbsp;private void createSShell() {<BR>&nbsp;&nbsp;sShell = new Shell();<BR>&nbsp;&nbsp;sShell.setText("Shell");<BR>&nbsp;&nbsp;createCanvas();<BR>&nbsp;&nbsp;sShell.setSize(new org.eclipse.swt.graphics.Point(588,367));<BR>&nbsp;&nbsp;startButton = new Button(sShell, SWT.NONE);<BR>&nbsp;&nbsp;startButton.setBounds(new org.eclipse.swt.graphics.Rectangle(87,284,76,33));<BR>&nbsp;&nbsp;startButton.setText("Start");<BR>&nbsp;&nbsp;startButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {<BR>&nbsp;&nbsp;&nbsp;public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;//System.out.println("widgetSelected()"); // TODO Auto-generated Event stub widgetSelected()<BR>&nbsp;&nbsp;&nbsp;&nbsp;new ballThread(40,40,canvas).start();<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;});<BR>&nbsp;}</P>
<P>}</P>
<P><BR>&nbsp;class ballThread extends Thread {</P>
<P>&nbsp;&nbsp;int x, y, xsize, ysize, addx, addy;<BR>&nbsp;&nbsp;Rectangle rc = null;<BR>&nbsp;&nbsp;GC gc = null;<BR>&nbsp;&nbsp;Canvas c = null;<BR>&nbsp;&nbsp;Color red = Display.getCurrent().getSystemColor(SWT.COLOR_RED);</P>
<P>&nbsp;&nbsp;public ballThread(int x,int y,Canvas ca) {<BR>&nbsp;&nbsp;&nbsp;c = ca;<BR>&nbsp;&nbsp;&nbsp;this.x = x;<BR>&nbsp;&nbsp;&nbsp;this.y = y;<BR>&nbsp;&nbsp;&nbsp;xsize = 10;<BR>&nbsp;&nbsp;&nbsp;ysize = 10;<BR>&nbsp;&nbsp;&nbsp;addx = 1;<BR>&nbsp;&nbsp;&nbsp;addy = 2;<BR>&nbsp;&nbsp;&nbsp;rc = c.getBounds();<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;public void draw(int x, int y, int xsize, int ysize) {<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;gc = new GC(c);<BR>&nbsp;&nbsp;&nbsp;gc.drawOval(x, y, xsize, ysize);<BR>&nbsp;&nbsp;&nbsp;gc.setBackground(red);<BR>&nbsp;&nbsp;&nbsp;gc.fillOval(x, y, xsize, ysize);<BR>&nbsp;&nbsp;&nbsp;gc.dispose();<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void clean() {<BR>&nbsp;&nbsp;&nbsp;gc = new GC(c);<BR>&nbsp;&nbsp;&nbsp;// Rectangle rt = canvas.getBounds();<BR>&nbsp;&nbsp;&nbsp;gc.drawRectangle(rc.x - 100, rc.y - 100, rc.width + 100,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rc.height + 100);<BR>&nbsp;&nbsp;&nbsp;gc.fillRectangle(rc.x - 100, rc.y - 100, rc.width + 100,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rc.height + 100);<BR>&nbsp;&nbsp;&nbsp;gc.dispose();<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void run() {<BR>&nbsp;&nbsp;&nbsp;for (int i = 1; i &lt; 1500; i++) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;try{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Display.getDefault().asyncExec(new Thread () {<BR>&nbsp;&nbsp;&nbsp;&nbsp;public void run(){<BR>&nbsp;&nbsp;&nbsp;&nbsp;draw(x, y, xsize, ysize);}});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread.sleep(10);<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Display.getDefault().asyncExec(new Thread () {<BR>&nbsp;&nbsp;&nbsp;&nbsp;public void run(){&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;clean();}});<BR>&nbsp;&nbsp;&nbsp;&nbsp;} catch (InterruptedException e) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO Auto-generated catch block<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;if (rc.contains(x, y)) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x += addx;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y += addy;<BR>&nbsp;&nbsp;&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (x &gt;= rc.width || x &lt;= 26) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addx = -addx;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x += addx;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y += addy;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (y &gt;= rc.height || y &lt;= 14) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addy = -addy;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x += addx;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y += addy;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;}<BR><BR>想到一个办法能够去除那些exceptions，就是在display.dispose()前加一句Thread.currentThread().stop();强制终止线程，不过这个办法肯定是最垃圾的办法.......<BR></P><img src ="http://www.blogjava.net/fortune/aggbug/31952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-02-22 13:13 <a href="http://www.blogjava.net/fortune/archive/2006/02/22/31952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT</title><link>http://www.blogjava.net/fortune/archive/2006/02/22/31925.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 22 Feb 2006 02:59:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/02/22/31925.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/31925.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/02/22/31925.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/31925.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/31925.html</trackback:ping><description><![CDATA[SWT应用程序结构：<BR>1.创建显示，它表示SWT会话<BR>2.创建一个或多个Shell，它表示应用程序的主窗口<BR>3.创建Shell内部所需的任何其它小部件<BR>4.初始化小部件的大小和必需的状态，为需要监听的小部件注册监听器<BR>5.打开Shell窗口<BR>6.运行事件调度循环直到发生退出情况为止<BR>7.清除显示<BR><BR>SWT提供的组件：<BR>1.显示（Display）<BR>&nbsp;管理平台事件循环，控制用户界面线程和其它线程之间的通信，除非是多线程否则不需要太多考虑display<BR>2.shell<BR>OS平台窗口管理器管理的一个“窗口”，辅助shell是作为另一个shell的子代创建的通常用作对话框或其它的瞬时窗口<BR>3.输入组件<BR>主要用来管理平台事件循环和控制用户界面线程和其它线程之间的通信，处理字符串的输入与输出，以及对应事件的发生。<BR>Button&nbsp;&nbsp; 有普通按钮push，check按钮，radio按钮，toggle按钮<BR>Text&nbsp; 可以输入文字 可指定单行，多行，和滚动行<BR>Combo <BR>Slider<BR>4.显示组件（用于显示文字，图片等）<BR>Label&nbsp;&nbsp;&nbsp;&nbsp;显示文字或图片<BR>Canvas<BR>List&nbsp;&nbsp;&nbsp;能够进行一览显示，可以从一览中选定一行或几行<BR>Table&nbsp;&nbsp;&nbsp;显示二维表格，可以在列头指定列名<BR>Tree<BR>ProgressBar&nbsp;&nbsp;&nbsp;显示进度条<BR>5.Menu/工具栏组件<BR>在窗口上配置Menu和工具栏<BR>Menu<BR>ToolBar&nbsp;&nbsp;&nbsp;显示工具栏<BR>CoolBar&nbsp;&nbsp;&nbsp;显示可以使用鼠标拖动的工具栏<BR>6.容器组件<BR>可以包含其它的Widget<BR>Composite<BR>Group<BR>TabFolder&nbsp;&nbsp;&nbsp;可以通过Tab换页<BR>SashForm<BR>7.对话框组件<BR>MessageBox&nbsp;&nbsp;&nbsp;显示message<BR>FileDialog&nbsp;&nbsp;&nbsp;指定文件<BR>DirectoryDialog&nbsp;&nbsp;&nbsp;&nbsp;指定路径<BR>ColorDialog&nbsp;&nbsp;&nbsp;指定颜色<BR>FontDialog&nbsp;&nbsp;&nbsp;指定字体<BR>PrintDialog&nbsp;&nbsp;&nbsp;指定打印机<BR>8.布局管理组件<BR>FillLayout&nbsp;&nbsp;&nbsp;填补空隙，水平或垂直配置<BR>FormLayout&nbsp;&nbsp;&nbsp;参照其它窗口进行布局<BR>RowLayout&nbsp;&nbsp;&nbsp;&nbsp;水平或垂直配置，可指定margin或widget之间的距离<BR>GridLayout<BR>StackLayout<BR><BR>布局<BR>1.FillLayout 填充布局<BR>是最简单的布局，将小部件布局在单行或单列中，强制他们全部使用相同的大小<BR>可以使用它对任务栏或工具栏中的按钮进行布局<BR>2.RowLayout 行布局<BR>（写不动了，休息先）<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><img src ="http://www.blogjava.net/fortune/aggbug/31925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-02-22 10:59 <a href="http://www.blogjava.net/fortune/archive/2006/02/22/31925.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SWT多线程（1）</title><link>http://www.blogjava.net/fortune/archive/2006/02/22/31899.html</link><dc:creator>fortune</dc:creator><author>fortune</author><pubDate>Wed, 22 Feb 2006 01:10:00 GMT</pubDate><guid>http://www.blogjava.net/fortune/archive/2006/02/22/31899.html</guid><wfw:comment>http://www.blogjava.net/fortune/comments/31899.html</wfw:comment><comments>http://www.blogjava.net/fortune/archive/2006/02/22/31899.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/fortune/comments/commentRss/31899.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/fortune/services/trackbacks/31899.html</trackback:ping><description><![CDATA[<BR>在SWT中，通常存在一个被称为"用户线程"的唯一线程，只有在这个线程中才能调用对构件或某些图形API的访问操作。如果在非用户线程中程序直接调用这些访问操作，那么SWTExcepiton异常会被抛出（if (display.thread != Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);）每一个在非用户线程中出现的widget都要通过检验看display.thread 是否等于Thread.currentThread()如果不相等就要抛出非法访问线程异常。但是SWT也在*.widget.Display类中提供了两个方法可以间接的在非用户线程的进行图形构件的访问操作，这是通过的syncExec(Runnable)和asyncExec(Runnable)这两个方法去实现的。<BR><BR><FONT size=1>&nbsp; </FONT><SPAN style="FONT-FAMILY: 宋体">对于</SPAN><SPAN lang=EN-US>Display</SPAN><SPAN style="FONT-FAMILY: 宋体">，在同一个线程里，不能申明</SPAN><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体">个</SPAN><SPAN lang=EN-US>Display</SPAN><SPAN style="FONT-FAMILY: 宋体">实例。同样的，一个</SPAN><SPAN lang=EN-US>Display</SPAN><SPAN style="FONT-FAMILY: 宋体">实例也不能跨线程使用。也就是说，如果你要在另外一个线程中显示一个窗体，（比如你要在任务完成后弹出一个对话框），你必须另外创建一个</SPAN><SPAN lang=EN-US>Display</SPAN><SPAN style="FONT-FAMILY: 宋体">实例。不然会导致异常。)</SPAN> <img src ="http://www.blogjava.net/fortune/aggbug/31899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/fortune/" target="_blank">fortune</a> 2006-02-22 09:10 <a href="http://www.blogjava.net/fortune/archive/2006/02/22/31899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>