﻿<?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-交口称赞-随笔分类-java相关</title><link>http://www.blogjava.net/vip01/category/26301.html</link><description>简单实用----逻辑清楚</description><language>zh-cn</language><lastBuildDate>Wed, 26 Dec 2007 03:37:19 GMT</lastBuildDate><pubDate>Wed, 26 Dec 2007 03:37:19 GMT</pubDate><ttl>60</ttl><item><title>学习Java6(十五)工具类Arrays(1)数组copy</title><link>http://www.blogjava.net/vip01/archive/2007/12/26/170460.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 26 Dec 2007 01:10:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/12/26/170460.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/170460.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/12/26/170460.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/170460.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/170460.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Arrays.toString 直接把数组转换成字符串<br>Arrays.copyOf(base, 4); copy 目标的前几个成员<br>Arrays.copyOfRange(base, 3, 6); 指定copy的范围&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/12/26/170460.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/170460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-12-26 09:10 <a href="http://www.blogjava.net/vip01/archive/2007/12/26/170460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习Java6(四)控制台(2)格式化输出</title><link>http://www.blogjava.net/vip01/archive/2007/12/26/170452.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 26 Dec 2007 00:55:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/12/26/170452.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/170452.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/12/26/170452.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/170452.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/170452.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: c风格的console输出,只能在cmd等命令行下执行&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/12/26/170452.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/170452.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-12-26 08:55 <a href="http://www.blogjava.net/vip01/archive/2007/12/26/170452.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习Java6(十四)排序工具类NavigableSet</title><link>http://www.blogjava.net/vip01/archive/2007/12/25/170303.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Tue, 25 Dec 2007 06:16:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/12/25/170303.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/170303.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/12/25/170303.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/170303.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/170303.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 排序工具类NavigableSet&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/12/25/170303.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/170303.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-12-25 14:16 <a href="http://www.blogjava.net/vip01/archive/2007/12/25/170303.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习Java6(十三)新的国家语言支持</title><link>http://www.blogjava.net/vip01/archive/2007/12/24/169959.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Mon, 24 Dec 2007 02:27:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/12/24/169959.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/169959.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/12/24/169959.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/169959.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/169959.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在java6中Locale类新增了以下国家语言的支持。&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/12/24/169959.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/169959.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-12-24 10:27 <a href="http://www.blogjava.net/vip01/archive/2007/12/24/169959.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习Java6(十二)日期工具类TimeUnit</title><link>http://www.blogjava.net/vip01/archive/2007/12/21/169368.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Fri, 21 Dec 2007 08:53:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/12/21/169368.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/169368.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/12/21/169368.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/169368.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/169368.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 比较有用的一个东西&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/12/21/169368.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/169368.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-12-21 16:53 <a href="http://www.blogjava.net/vip01/archive/2007/12/21/169368.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习Java6(十一)集合对象--堆栈</title><link>http://www.blogjava.net/vip01/archive/2007/09/30/149913.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Sun, 30 Sep 2007 07:23:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/09/30/149913.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/149913.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/09/30/149913.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/149913.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/149913.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 集合对象--堆栈&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/09/30/149913.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/149913.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-09-30 15:23 <a href="http://www.blogjava.net/vip01/archive/2007/09/30/149913.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FormatSqlResult2.0 增加对中文和和空列的识别</title><link>http://www.blogjava.net/vip01/archive/2007/08/10/135725.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Fri, 10 Aug 2007 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/08/10/135725.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/135725.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/08/10/135725.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/135725.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/135725.html</trackback:ping><description><![CDATA[应朋友要求，写了一个小工具,主要就是实现下面的要求：<br /><img height="1000" alt="FormatSqlResult.jpg" src="http://www.blogjava.net/images/blogjava_net/vip01/FormatSqlResult.jpg" width="698" border="0" /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">  1</span> <span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> java.util.LinkedList;<br /></span><span style="COLOR: #008080">  2</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">  3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.SWT;<br /></span><span style="COLOR: #008080">  4</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.events.KeyAdapter;<br /></span><span style="COLOR: #008080">  5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.events.KeyEvent;<br /></span><span style="COLOR: #008080">  6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.events.SelectionAdapter;<br /></span><span style="COLOR: #008080">  7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.events.SelectionEvent;<br /></span><span style="COLOR: #008080">  8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.layout.FormAttachment;<br /></span><span style="COLOR: #008080">  9</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.layout.FormData;<br /></span><span style="COLOR: #008080"> 10</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.layout.FormLayout;<br /></span><span style="COLOR: #008080"> 11</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.widgets.Button;<br /></span><span style="COLOR: #008080"> 12</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.widgets.Display;<br /></span><span style="COLOR: #008080"> 13</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.widgets.Label;<br /></span><span style="COLOR: #008080"> 14</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.widgets.Shell;<br /></span><span style="COLOR: #008080"> 15</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> org.eclipse.swt.widgets.Text;<br /></span><span style="COLOR: #008080"> 16</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 17</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> FormatSqlResult {<br /></span><span style="COLOR: #008080"> 18</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 19</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> Text text;<br /></span><span style="COLOR: #008080"> 20</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 21</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> Shell shell;<br /></span><span style="COLOR: #008080"> 22</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 23</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 24</span> <span style="COLOR: #008000">     * Launch the application<br /></span><span style="COLOR: #008080"> 25</span> <span style="COLOR: #008000">     * <br /></span><span style="COLOR: #008080"> 26</span> <span style="COLOR: #008000">     * </span><span style="COLOR: #808080">@param</span><span style="COLOR: #008000"> args<br /></span><span style="COLOR: #008080"> 27</span> <span style="COLOR: #008000">     </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 28</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) {<br /></span><span style="COLOR: #008080"> 29</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080"> 30</span> <span style="COLOR: #000000">            FormatSqlResult window </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormatSqlResult();<br /></span><span style="COLOR: #008080"> 31</span> <span style="COLOR: #000000">            window.open();<br /></span><span style="COLOR: #008080"> 32</span> <span style="COLOR: #000000">        } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (Exception e) {<br /></span><span style="COLOR: #008080"> 33</span> <span style="COLOR: #000000">            e.printStackTrace();<br /></span><span style="COLOR: #008080"> 34</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080"> 35</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080"> 36</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 37</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 38</span> <span style="COLOR: #008000">     * Open the window<br /></span><span style="COLOR: #008080"> 39</span> <span style="COLOR: #008000">     </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 40</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> open() {<br /></span><span style="COLOR: #008080"> 41</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Display display </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Display.getDefault();<br /></span><span style="COLOR: #008080"> 42</span> <span style="COLOR: #000000">        createContents();<br /></span><span style="COLOR: #008080"> 43</span> <span style="COLOR: #000000">        shell.open();<br /></span><span style="COLOR: #008080"> 44</span> <span style="COLOR: #000000">        shell.layout();<br /></span><span style="COLOR: #008080"> 45</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">shell.isDisposed()) {<br /></span><span style="COLOR: #008080"> 46</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">display.readAndDispatch())<br /></span><span style="COLOR: #008080"> 47</span> <span style="COLOR: #000000">                display.sleep();<br /></span><span style="COLOR: #008080"> 48</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080"> 49</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080"> 50</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 51</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 52</span> <span style="COLOR: #008000">     * Create contents of the window<br /></span><span style="COLOR: #008080"> 53</span> <span style="COLOR: #008000">     </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 54</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> createContents() {<br /></span><span style="COLOR: #008080"> 55</span> <span style="COLOR: #000000">        shell </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Shell();<br /></span><span style="COLOR: #008080"> 56</span> <span style="COLOR: #000000">        shell.setLayout(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormLayout());<br /></span><span style="COLOR: #008080"> 57</span> <span style="COLOR: #000000">        shell.setSize(</span><span style="COLOR: #000000">631</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">414</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 58</span> <span style="COLOR: #000000">        shell.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">FormatSqlResult</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 59</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 60</span> <span style="COLOR: #000000">        text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Text(shell, SWT.V_SCROLL </span><span style="COLOR: #000000">|</span><span style="COLOR: #000000"> SWT.MULTI </span><span style="COLOR: #000000">|</span><span style="COLOR: #000000"> SWT.H_SCROLL </span><span style="COLOR: #000000">|</span><span style="COLOR: #000000"> SWT.BORDER);<br /></span><span style="COLOR: #008080"> 61</span> <span style="COLOR: #000000">        text.addKeyListener(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> KeyAdapter() {<br /></span><span style="COLOR: #008080"> 62</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> keyPressed(KeyEvent e) {<br /></span><span style="COLOR: #008080"> 63</span> <span style="COLOR: #000000">                System.out.println(e.keyCode);<br /></span><span style="COLOR: #008080"> 64</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080"> 65</span> <span style="COLOR: #000000">        });<br /></span><span style="COLOR: #008080"> 66</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080"> 67</span> <span style="COLOR: #000000">        fd_text.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">34</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 68</span> <span style="COLOR: #000000">        fd_text.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 69</span> <span style="COLOR: #000000">        fd_text.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 70</span> <span style="COLOR: #000000">        fd_text.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 71</span> <span style="COLOR: #000000">        text.setLayoutData(fd_text);<br /></span><span style="COLOR: #008080"> 72</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Button formatButton </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Button(shell, SWT.NONE);<br /></span><span style="COLOR: #008080"> 73</span> <span style="COLOR: #000000">        formatButton.addSelectionListener(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SelectionAdapter() {<br /></span><span style="COLOR: #008080"> 74</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> widgetSelected(SelectionEvent e) {<br /></span><span style="COLOR: #008080"> 75</span> <span style="COLOR: #000000">                String str </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> text.getText();<br /></span><span style="COLOR: #008080"> 76</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (str </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000"> str.length() </span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080"> 77</span> <span style="COLOR: #000000">                    text.setText(getSpaceText(str.replaceAll(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\r</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">)));<br /></span><span style="COLOR: #008080"> 78</span> <span style="COLOR: #000000">                    text.selectAll();<br /></span><span style="COLOR: #008080"> 79</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080"> 80</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 81</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080"> 82</span> <span style="COLOR: #000000">        });<br /></span><span style="COLOR: #008080"> 83</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_formatButton </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080"> 84</span> <span style="COLOR: #000000">        fd_formatButton.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">286</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 85</span> <span style="COLOR: #000000">        fd_formatButton.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">287</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 86</span> <span style="COLOR: #000000">        fd_formatButton.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 87</span> <span style="COLOR: #000000">        fd_formatButton.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 88</span> <span style="COLOR: #000000">        formatButton.setLayoutData(fd_formatButton);<br /></span><span style="COLOR: #008080"> 89</span> <span style="COLOR: #000000">        formatButton.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Format</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 90</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 91</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Label label </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Label(shell, SWT.NONE);<br /></span><span style="COLOR: #008080"> 92</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_label </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080"> 93</span> <span style="COLOR: #000000">        fd_label.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">19</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 94</span> <span style="COLOR: #000000">        fd_label.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">130</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 95</span> <span style="COLOR: #000000">        fd_label.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 96</span> <span style="COLOR: #000000">        fd_label.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 97</span> <span style="COLOR: #000000">        label.setLayoutData(fd_label);<br /></span><span style="COLOR: #008080"> 98</span> <span style="COLOR: #000000">        label.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">版权所有：交口称赞</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 99</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">100</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Label formatsqlresult10Label </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Label(shell, SWT.NONE);<br /></span><span style="COLOR: #008080">101</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_formatsqlresult10Label </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080">102</span> <span style="COLOR: #000000">        fd_formatsqlresult10Label.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">19</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">103</span> <span style="COLOR: #000000">        fd_formatsqlresult10Label.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">180</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">104</span> <span style="COLOR: #000000">        fd_formatsqlresult10Label.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">105</span> <span style="COLOR: #000000">        fd_formatsqlresult10Label.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">106</span> <span style="COLOR: #000000">        formatsqlresult10Label.setLayoutData(fd_formatsqlresult10Label);<br /></span><span style="COLOR: #008080">107</span> <span style="COLOR: #000000">        formatsqlresult10Label.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">FormatSqlResult version 2.0</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">108</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">109</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Button button </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Button(shell, SWT.NONE);<br /></span><span style="COLOR: #008080">110</span> <span style="COLOR: #000000">        button.addSelectionListener(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SelectionAdapter() {<br /></span><span style="COLOR: #008080">111</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> widgetSelected(SelectionEvent e) {<br /></span><span style="COLOR: #008080">112</span> <span style="COLOR: #000000">                text.selectAll();<br /></span><span style="COLOR: #008080">113</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">114</span> <span style="COLOR: #000000">        });<br /></span><span style="COLOR: #008080">115</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_button </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080">116</span> <span style="COLOR: #000000">        fd_button.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(formatButton, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">22</span><span style="COLOR: #000000">, SWT.BOTTOM);<br /></span><span style="COLOR: #008080">117</span> <span style="COLOR: #000000">        fd_button.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(formatButton, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, SWT.BOTTOM);<br /></span><span style="COLOR: #008080">118</span> <span style="COLOR: #000000">        fd_button.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">239</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">119</span> <span style="COLOR: #000000">        fd_button.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">275</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">120</span> <span style="COLOR: #000000">        button.setLayoutData(fd_button);<br /></span><span style="COLOR: #008080">121</span> <span style="COLOR: #000000">        button.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">全选</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">122</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">123</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Button button_1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Button(shell, SWT.NONE);<br /></span><span style="COLOR: #008080">124</span> <span style="COLOR: #000000">        button_1.addSelectionListener(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SelectionAdapter() {<br /></span><span style="COLOR: #008080">125</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> widgetSelected(SelectionEvent e) {<br /></span><span style="COLOR: #008080">126</span> <span style="COLOR: #000000">                text.setText(</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">127</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">128</span> <span style="COLOR: #000000">        });<br /></span><span style="COLOR: #008080">129</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> FormData fd_button_1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormData();<br /></span><span style="COLOR: #008080">130</span> <span style="COLOR: #000000">        fd_button_1.left </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(formatButton, </span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">, SWT.DEFAULT);<br /></span><span style="COLOR: #008080">131</span> <span style="COLOR: #000000">        fd_button_1.right </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">242</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">132</span> <span style="COLOR: #000000">        fd_button_1.bottom </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">133</span> <span style="COLOR: #000000">        fd_button_1.top </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FormAttachment(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">134</span> <span style="COLOR: #000000">        button_1.setLayoutData(fd_button_1);<br /></span><span style="COLOR: #008080">135</span> <span style="COLOR: #000000">        button_1.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">清空</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">136</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">137</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">138</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String getSpaceText(String allStr) {<br /></span><span style="COLOR: #008080">139</span> <span style="COLOR: #000000">        String[] strs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> allStr.split(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">140</span> <span style="COLOR: #000000">        String lineStr;<br /></span><span style="COLOR: #008080">141</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> row </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">142</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (strs </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000"> strs.length </span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">143</span> <span style="COLOR: #000000">            lineStr </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strs[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">];<br /></span><span style="COLOR: #008080">144</span> <span style="COLOR: #000000">            String[] lineStrs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> lineStr.split(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\t</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">145</span> <span style="COLOR: #000000">            row </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> lineStrs.length;<br /></span><span style="COLOR: #008080">146</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">147</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[] max </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[row];<br /></span><span style="COLOR: #008080">148</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> max.length; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">149</span> <span style="COLOR: #000000">            max[i] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">150</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">151</span> <span style="COLOR: #000000">        LinkedList all </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LinkedList();<br /></span><span style="COLOR: #008080">152</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> row; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">153</span> <span style="COLOR: #000000">            LinkedList list </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LinkedList();<br /></span><span style="COLOR: #008080">154</span> <span style="COLOR: #000000">            all.add(list);<br /></span><span style="COLOR: #008080">155</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">156</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> strs.length; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">157</span> <span style="COLOR: #000000">            lineStr </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strs[i];<br /></span><span style="COLOR: #008080">158</span> <span style="COLOR: #000000">            String[] lineStrs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> lineStr.split(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\t</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">159</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> length </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">160</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; j </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> row; j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">161</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (j </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> lineStrs.length) {<br /></span><span style="COLOR: #008080">162</span> <span style="COLOR: #000000">                    length </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> lineStrs[j].getBytes().length;<br /></span><span style="COLOR: #008080">163</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (length </span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"> max[j]) {<br /></span><span style="COLOR: #008080">164</span> <span style="COLOR: #000000">                        max[j] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> length;<br /></span><span style="COLOR: #008080">165</span> <span style="COLOR: #000000">                    }<br /></span><span style="COLOR: #008080">166</span> <span style="COLOR: #000000">                    ((LinkedList) all.get(j)).add(lineStrs[j]);<br /></span><span style="COLOR: #008080">167</span> <span style="COLOR: #000000">                } </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080">168</span> <span style="COLOR: #000000">                    ((LinkedList) all.get(j)).add(</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">169</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">170</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">171</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">172</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">173</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">174</span> <span style="COLOR: #000000">        StringBuffer sb </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> StringBuffer();<br /></span><span style="COLOR: #008080">175</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> line </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ((LinkedList) all.get(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)).size();<br /></span><span style="COLOR: #008080">176</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> line; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">177</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; j </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> all.size(); j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">178</span> <span style="COLOR: #000000">                String str </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (String) ((LinkedList) all.get(j)).get(i);<br /></span><span style="COLOR: #008080">179</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> length </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> max[j] </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> str.getBytes().length </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">180</span> <span style="COLOR: #000000">                sb.append(str);<br /></span><span style="COLOR: #008080">181</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> k </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; k </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> length; k</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">182</span> <span style="COLOR: #000000">                    sb.append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">183</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">184</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">185</span> <span style="COLOR: #000000">            sb.append(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">186</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">187</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> sb.toString();<br /></span><span style="COLOR: #008080">188</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">189</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">190</span> <span style="COLOR: #000000">}<br /></span><span style="COLOR: #008080">191</span> <span style="COLOR: #000000"></span></div><br />已制作成exe，可以双击执行，只支持Windows，为了兼容jdk版本，没敢用泛型。 
<p>下载：<a href="/Files/vip01/FormatSqlResult2.rar"><font color="#002c99">FormatSqlResult2.rar</font></a></p><img src ="http://www.blogjava.net/vip01/aggbug/135725.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-08-10 09:55 <a href="http://www.blogjava.net/vip01/archive/2007/08/10/135725.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FormatSqlResult--SQL查询结果，格式化工具，已作成exe，付源码</title><link>http://www.blogjava.net/vip01/archive/2007/08/09/135420.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Thu, 09 Aug 2007 03:02:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/08/09/135420.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/135420.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/08/09/135420.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/135420.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/135420.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 应朋友要求，写了一个小工具&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/08/09/135420.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/135420.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-08-09 11:02 <a href="http://www.blogjava.net/vip01/archive/2007/08/09/135420.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搞死人的oracle的日期国际化问题</title><link>http://www.blogjava.net/vip01/archive/2007/05/16/117804.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 16 May 2007 04:11:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/05/16/117804.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/117804.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/05/16/117804.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/117804.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/117804.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 这两天修改以前的老代码，碰到一个头痛的问题。<br>有些页面在服务器上正常，在本地jboss就不正常。<br>&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/05/16/117804.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/117804.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-05-16 12:11 <a href="http://www.blogjava.net/vip01/archive/2007/05/16/117804.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>修改jboos的默认虚拟机</title><link>http://www.blogjava.net/vip01/archive/2007/04/18/111626.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 18 Apr 2007 06:23:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/04/18/111626.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/111626.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/04/18/111626.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/111626.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/111626.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/04/18/111626.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/111626.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-04-18 14:23 <a href="http://www.blogjava.net/vip01/archive/2007/04/18/111626.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SVN快速上手（二）权限分配，控制到每个目录</title><link>http://www.blogjava.net/vip01/archive/2007/04/12/110138.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Thu, 12 Apr 2007 04:54:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/04/12/110138.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/110138.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/04/12/110138.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/110138.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/110138.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: SVN快速上手（二）权限分配，控制到每个目录&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/04/12/110138.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/110138.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-04-12 12:54 <a href="http://www.blogjava.net/vip01/archive/2007/04/12/110138.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SVN快速上手（一）安装</title><link>http://www.blogjava.net/vip01/archive/2007/04/12/110136.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Thu, 12 Apr 2007 04:43:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/04/12/110136.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/110136.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/04/12/110136.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/110136.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/110136.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: SVN快速上手（一）安装&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/04/12/110136.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/110136.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-04-12 12:43 <a href="http://www.blogjava.net/vip01/archive/2007/04/12/110136.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>replaceAll("\\\\", "\\\\\\\\")的秘密</title><link>http://www.blogjava.net/vip01/archive/2007/01/11/93115.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Thu, 11 Jan 2007 03:40:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/11/93115.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/93115.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/11/93115.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/93115.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/93115.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: replaceAll("\\\\", "\\\\\\\\")的秘密&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/01/11/93115.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/93115.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-11 11:40 <a href="http://www.blogjava.net/vip01/archive/2007/01/11/93115.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>真正最正确的用BAT运行JAVA不显示DOS窗口（连闪一下都不闪）</title><link>http://www.blogjava.net/vip01/archive/2007/01/09/92527.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Tue, 09 Jan 2007 02:29:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/09/92527.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/92527.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/09/92527.html#Feedback</comments><slash:comments>40</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/92527.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/92527.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 快试试吧，绝对不闪了。哈哈哈。&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/01/09/92527.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/92527.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-09 10:29 <a href="http://www.blogjava.net/vip01/archive/2007/01/09/92527.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PO BO VO DTO POJO DAO概念及其作用（附转换图）</title><link>http://www.blogjava.net/vip01/archive/2007/01/08/92430.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Mon, 08 Jan 2007 09:52:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/08/92430.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/92430.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/08/92430.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/92430.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/92430.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:     总结下我认为一个对象究竟是什么O要看具体环境，在不同的层、不同的应用场合，对象的身份也不一样，而且对象身份的转化也是很自然的。就像你对老婆来说就是老公，对父母来说就是子女。设计这些概念的初衷不是为了唬人而是为了更好的理解和处理各种逻辑，让大家能更好的去用面向对象的方式处理问题.&nbsp;&nbsp;<a href='http://www.blogjava.net/vip01/archive/2007/01/08/92430.html'>阅读全文</a><img src ="http://www.blogjava.net/vip01/aggbug/92430.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-08 17:52 <a href="http://www.blogjava.net/vip01/archive/2007/01/08/92430.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重定向控制台输出(四)重定向tomcat的控制台输出(转)</title><link>http://www.blogjava.net/vip01/archive/2007/01/03/91551.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 03 Jan 2007 07:51:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/03/91551.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/91551.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/03/91551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/91551.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/91551.html</trackback:ping><description><![CDATA[startup.bat倒数第二行改成：   <br />    <br />  call   "%EXECUTABLE%"   run   %CMD_LINE_ARGS%   <br />    <br />    <br />  catalina.bat最后一段的相应的一句改成(这里改的是   :doneSetArgs这一段的)：   <br />    <br />  %_EXECJAVA%   %JAVA_OPTS%   %CATALINA_OPTS%   %DEBUG_OPTS%   -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%"   -classpath   "%CLASSPATH%"   -Dcatalina.base="%CATALINA_BASE%"   -Dcatalina.home="%CATALINA_HOME%"   -Djava.io.tmpdir="%CATALINA_TMPDIR%"   %MAINCLASS%   %CMD_LINE_ARGS%   %ACTION%   &gt;&gt;ttt.txt   <br />    <br />  以后可查看&lt;Tomcat_Home&gt;/bin/ttt.txt。<br /><br />原帖<br /><a href="http://topic.csdn.net/t/20041019/13/3469893.html">http://topic.csdn.net/t/20041019/13/3469893.html</a><br />未经证实<br />哪位朋友确认可行的请说下<br /><br />不过按道理说应该可行<br />因为他也是用的重定向操作符的<br />参见:<br /><a class="titlelink" id="Editor_Results_rprSelectionList_ctl01_LinkTitle" href="/vip01/archive/2007/01/03/91548.html"><font color="#000000">重定向控制台输出(三)WINDOWS下的巧妙猥琐的处理方式</font></a><img src ="http://www.blogjava.net/vip01/aggbug/91551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-03 15:51 <a href="http://www.blogjava.net/vip01/archive/2007/01/03/91551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重定向控制台输出(三)WINDOWS下的巧妙猥琐的处理方式</title><link>http://www.blogjava.net/vip01/archive/2007/01/03/91548.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 03 Jan 2007 07:47:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/03/91548.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/91548.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/03/91548.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/91548.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/91548.html</trackback:ping><description><![CDATA[
		<p>Vista时代的到来,DOS还有用吗,命令行还有用吗?当然!<br /><br />对于任意win下的程序,在命令行中就支持输出重定向.<br /><br />比如在cmd下输入ping 127.0.0.1 &gt;&gt; c:\test.txt<br /><br />控制没有任何输出?!<br /><br />去看看c盘下的test.txt<br /></p>
		<p>
				<br />Pinging 127.0.0.1 with 32 bytes of data:</p>
		<p>Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128<br />Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128<br />Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128<br />Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128</p>
		<p>Ping statistics for 127.0.0.1:<br />    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),<br />Approximate round trip times in milli-seconds:<br />    Minimum = 0ms, Maximum = 0ms, Average = 0ms<br /><br />这就是重定向操作符"&gt;&gt;"的作用<br /></p>
		<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
				<span style="COLOR: rgb(0,128,128)">1</span> <span style="COLOR: rgb(0,0,255)">public</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">class</span><span style="COLOR: rgb(0,0,0)"> TestWinCon {<br /></span><span style="COLOR: rgb(0,128,128)">2</span> <span style="COLOR: rgb(0,0,0)">    </span><span style="COLOR: rgb(0,128,0)">/**</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)">3</span> <span style="COLOR: rgb(0,128,0)">     * </span><span style="COLOR: rgb(128,128,128)">@param</span><span style="COLOR: rgb(0,128,0)"> args<br /></span><span style="COLOR: rgb(0,128,128)">4</span> <span style="COLOR: rgb(0,128,0)">     </span><span style="COLOR: rgb(0,128,0)">*/</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">5</span> <span style="COLOR: rgb(0,0,0)">    </span><span style="COLOR: rgb(0,0,255)">public</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">static</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">void</span><span style="COLOR: rgb(0,0,0)"> main(String[] args) {<br /></span><span style="COLOR: rgb(0,128,128)">6</span> <span style="COLOR: rgb(0,0,0)">        System.out.println(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">haha</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">7</span> <span style="COLOR: rgb(0,0,0)">    }<br /></span><span style="COLOR: rgb(0,128,128)">8</span> <span style="COLOR: rgb(0,0,0)">}<br /></span><span style="COLOR: rgb(0,128,128)">9</span> <span style="COLOR: rgb(0,0,0)"></span></div>
		<p>cmd下执行<br />java TestWinCon &gt;&gt;aa.txt<br /><br />会在本目录下生成aa.txt<br />内容就是<br />haha<br /><br /></p>
<img src ="http://www.blogjava.net/vip01/aggbug/91548.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-03 15:47 <a href="http://www.blogjava.net/vip01/archive/2007/01/03/91548.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重定向控制台输出(二)其它JAVA程序控制台输出</title><link>http://www.blogjava.net/vip01/archive/2007/01/03/91543.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 03 Jan 2007 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/03/91543.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/91543.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/03/91543.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/91543.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/91543.html</trackback:ping><description><![CDATA[对于独立运行的程序,其实不仅局限于java程序......<br />都可以写个前端程序去截获其控制台输出<br /><br />process = Runtime.getRuntime().exec("你要执行的程序");<br /><br />InputStream in = process.getInputStream();<br />InputStream err =process.getErrorStream();<br /><br />然后安装<a class="singleposttitle" id="viewpost1_TitleUrl" href="/vip01/archive/2007/01/03/91538.html"><font color="#223355">重定向控制台输出(一)普通JAVA程序控制台输出</font></a> 一文中的方式,分别各开一个线程去读取.<br /><br /><img src ="http://www.blogjava.net/vip01/aggbug/91543.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-03 15:38 <a href="http://www.blogjava.net/vip01/archive/2007/01/03/91543.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重定向控制台输出(一)普通JAVA程序控制台输出</title><link>http://www.blogjava.net/vip01/archive/2007/01/03/91538.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 03 Jan 2007 07:01:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/03/91538.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/91538.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/03/91538.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/91538.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/91538.html</trackback:ping><description><![CDATA[平时开发时我们能很方便的在eclipse中看到控制图输出信息.一旦程序独立运行,我们就很难看到这些信息了.尤其是有时候我们程序对LOG4J使用不规范,开发中随意用System.out.println();输出程序运行信息.<br /><br />反正是总有人因为某些原因要捕获控制台输入........(比如偶^_^)<br /><br /><br />对于普通的java程序包括swt程序,我们可以把控制台输出重定向到文本文件或者界面文本框.<br /><br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> ConsoleThread </span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000"> Thread {<br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> PipedInputStream pis </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> PipedInputStream();<br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> PipedOutputStream pos;<br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> BufferedReader reader </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> BufferedReader(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> InputStreamReader(pis));<br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> run </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> ConsoleThread() </span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000"> IOException {<br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">            pos </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> PipedOutputStream(pis);<br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> PipedOutputStream getOut() {<br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> pos;<br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> run() {<br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">            String line </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> (run) {<br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">                    line </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> reader.readLine();<br /></span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">                } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (IOException ioe) {<br /></span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (line </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">27</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000">                } </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080">29</span> <span style="COLOR: #000000">                    addText(line);//<font color="#ff0000">这里处理截获的控制台输出</font><br /></span><span style="COLOR: #008080">30</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">31</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">32</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">33</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">34</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> isRun() {<br /></span><span style="COLOR: #008080">35</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> run;<br /></span><span style="COLOR: #008080">36</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">37</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">38</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> setRun(</span><span style="COLOR: #0000ff">boolean</span><span style="COLOR: #000000"> run) {<br /></span><span style="COLOR: #008080">39</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.run </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> run;<br /></span><span style="COLOR: #008080">40</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">41</span> <span style="COLOR: #000000">    }</span></div><br /><br />调用:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000">            ConsoleThread coThread  </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> ConsoleThread();<br /></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">            System.setOut(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> PrintStream(coThread.getOut(), </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">));<br /></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">            System.setErr(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> PrintStream(coThread.getOut(), </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">));<br /></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">            coThread.start();<br /></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">        } </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (IOException e) {<br /></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">            e.printStackTrace();<br /></span><span style="COLOR: #008080">8</span> <span style="COLOR: #000000">        }</span></div><br />但是有个问题,log4j输出到控制台的信息捕获不到........<br />郁闷<br /><br />log4j.properties<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span> <span style="COLOR: #000000">log4j.rootLogger</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">DEBUG , stdout<br /></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">log4j.appender.stdout</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">org.apache.log4j.ConsoleAppender<br /></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">log4j.appender.console.Target </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.out<br /></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">log4j.appender.stdout.layout</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">org.apache.log4j.PatternLayout<br /></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">log4j.appender.stdout.layout.ConversionPattern</span><span style="COLOR: #000000">=%</span><span style="COLOR: #000000">d </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">p [</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">c] </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">m</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">n</span></div><br /><img src ="http://www.blogjava.net/vip01/aggbug/91538.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-03 15:01 <a href="http://www.blogjava.net/vip01/archive/2007/01/03/91538.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>格式化System.currentTimeMillis()</title><link>http://www.blogjava.net/vip01/archive/2007/01/03/91502.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Wed, 03 Jan 2007 03:05:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2007/01/03/91502.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/91502.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2007/01/03/91502.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/91502.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/91502.html</trackback:ping><description><![CDATA[
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> java.text.SimpleDateFormat;<br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> java.util.Locale;<br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> FormatCurrentTime {<br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #008000">     * </span><span style="COLOR: #808080">@param</span><span style="COLOR: #008000"> args<br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #008000">     </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) {<br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">        <br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">, Locale.SIMPLIFIED_CHINESE);<br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">        sdf.applyPattern(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yyyy年MM月dd日 HH时mm分ss秒</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">        System.out.println(sdf.format(System.currentTimeMillis()));<br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">        <br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">}<br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000"></span></div>
<img src ="http://www.blogjava.net/vip01/aggbug/91502.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2007-01-03 11:05 <a href="http://www.blogjava.net/vip01/archive/2007/01/03/91502.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>强！简洁！SWT实现任务栏图标（系统托盘），带菜单和ToolTip</title><link>http://www.blogjava.net/vip01/archive/2006/12/26/90127.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Tue, 26 Dec 2006 07:47:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2006/12/26/90127.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/90127.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2006/12/26/90127.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/90127.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/90127.html</trackback:ping><description><![CDATA[
		<p>看到有位朋友在偶“<a class="singleposttitle" id="viewpost1_TitleUrl" href="/vip01/archive/2006/12/25/89875.html">为RCP程序增加关闭提示和关闭到系统托盘</a>”的文章里面的留言，忍不住把自己以前N老的一篇帖子扒出来了。<br />此文可能是当初最早最完善的SWT实现任务栏图标，带菜单、带ToolTip的完整的例子。<br />期间还有CSDN会员GhostValley;pdvv的指教。<br /><br /><br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">import org.eclipse.swt.SWT;<br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">import org.eclipse.swt.events.ShellListener;<br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">import org.eclipse.swt.graphics.Image;<br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">import org.eclipse.swt.internal.win32.OS;<br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Display;<br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Event;<br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Listener;<br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Menu;<br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.MenuItem;<br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Shell;<br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.Tray;<br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">import org.eclipse.swt.widgets.TrayItem;<br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">public class MyTray {<br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    public static </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) {<br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">        Display display </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Display();<br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">        Shell shell </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Shell(display);<br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 下面两句的效果是：在任务栏不显示</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 感谢CSDN会员：GhostValley(鬼谷)</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">        final </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> hWnd </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> shell.handle;<br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">        OS.SetWindowLong(hWnd, OS.GWL_EXSTYLE, OS.WS_EX_CAPTIONOKBTN);<br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">        Image image </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Image(display, </span><span style="COLOR: #000000">16</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">16</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">        final Tray tray </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> display.getSystemTray();<br /></span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (tray </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">            System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The system tray is not available</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">        } </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> {<br /></span><span style="COLOR: #008080">27</span> <span style="COLOR: #000000">            final TrayItem item </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TrayItem(tray, SWT.NONE);<br /></span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000">            item.setToolTipText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">SWT TrayItem</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">29</span> <span style="COLOR: #000000">            item.addListener(SWT.Show, </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Listener() {<br /></span><span style="COLOR: #008080">30</span> <span style="COLOR: #000000">                public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> handleEvent(Event event) {<br /></span><span style="COLOR: #008080">31</span> <span style="COLOR: #000000">                    System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">show</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">32</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">33</span> <span style="COLOR: #000000">            });<br /></span><span style="COLOR: #008080">34</span> <span style="COLOR: #000000">            item.addListener(SWT.Hide, </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Listener() {<br /></span><span style="COLOR: #008080">35</span> <span style="COLOR: #000000">                public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> handleEvent(Event event) {<br /></span><span style="COLOR: #008080">36</span> <span style="COLOR: #000000">                    System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">hide</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">37</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">38</span> <span style="COLOR: #000000">            });<br /></span><span style="COLOR: #008080">39</span> <span style="COLOR: #000000">            item.addListener(SWT.Selection, </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Listener() {<br /></span><span style="COLOR: #008080">40</span> <span style="COLOR: #000000">                public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> handleEvent(Event event) {<br /></span><span style="COLOR: #008080">41</span> <span style="COLOR: #000000">                    System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">selection</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">42</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">43</span> <span style="COLOR: #000000">            });<br /></span><span style="COLOR: #008080">44</span> <span style="COLOR: #000000">            item.addListener(SWT.DefaultSelection, </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Listener() {<br /></span><span style="COLOR: #008080">45</span> <span style="COLOR: #000000">                public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> handleEvent(Event event) {<br /></span><span style="COLOR: #008080">46</span> <span style="COLOR: #000000">                    System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">default selection</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">47</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> show main</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">48</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                    Shell s </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> event.display.getShells()[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">];<br /></span><span style="COLOR: #008080">49</span> <span style="COLOR: #000000">                    s.setVisible(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">50</span> <span style="COLOR: #000000">                    s.setMinimized(</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">51</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">52</span> <span style="COLOR: #000000">            });<br /></span><span style="COLOR: #008080">53</span> <span style="COLOR: #000000">            final Menu menu </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Menu(shell, SWT.POP_UP);<br /></span><span style="COLOR: #008080">54</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br /></span><span style="COLOR: #008080">55</span> <span style="COLOR: #000000">                MenuItem mi </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MenuItem(menu, SWT.PUSH);<br /></span><span style="COLOR: #008080">56</span> <span style="COLOR: #000000">                mi.setText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Item</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> i);<br /></span><span style="COLOR: #008080">57</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">58</span> <span style="COLOR: #000000">            item.addListener(SWT.MenuDetect, </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Listener() {<br /></span><span style="COLOR: #008080">59</span> <span style="COLOR: #000000">                public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> handleEvent(Event event) {<br /></span><span style="COLOR: #008080">60</span> <span style="COLOR: #000000">                    menu.setVisible(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">61</span> <span style="COLOR: #000000">                }<br /></span><span style="COLOR: #008080">62</span> <span style="COLOR: #000000">            });<br /></span><span style="COLOR: #008080">63</span> <span style="COLOR: #000000">            item.setImage(image);<br /></span><span style="COLOR: #008080">64</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">65</span> <span style="COLOR: #000000">        shell.addShellListener(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> ShellListener() {<br /></span><span style="COLOR: #008080">66</span> <span style="COLOR: #000000">            public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> shellDeactivated(org.eclipse.swt.events.ShellEvent e) {<br /></span><span style="COLOR: #008080">67</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">68</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">69</span> <span style="COLOR: #000000">            public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> shellActivated(org.eclipse.swt.events.ShellEvent e) {<br /></span><span style="COLOR: #008080">70</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">71</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">72</span> <span style="COLOR: #000000">            public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> shellClosed(org.eclipse.swt.events.ShellEvent e) {<br /></span><span style="COLOR: #008080">73</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">74</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">75</span> <span style="COLOR: #000000">            public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> shellDeiconified(org.eclipse.swt.events.ShellEvent e) {<br /></span><span style="COLOR: #008080">76</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">77</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">78</span> <span style="COLOR: #000000">            public </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> shellIconified(org.eclipse.swt.events.ShellEvent e) {<br /></span><span style="COLOR: #008080">79</span> <span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 最小化时不显示在任务栏</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">80</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 感谢CSDN会员：pdvv(我爱花猫)</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">81</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                ((Shell) e.getSource()).setVisible(</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">82</span> <span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">83</span> <span style="COLOR: #000000">        });<br /></span><span style="COLOR: #008080">84</span> <span style="COLOR: #000000">        shell.setBounds(</span><span style="COLOR: #000000">50</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">50</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">300</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">200</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">85</span> <span style="COLOR: #000000">        shell.open();<br /></span><span style="COLOR: #008080">86</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">shell.isDisposed()) {<br /></span><span style="COLOR: #008080">87</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">display.readAndDispatch())<br /></span><span style="COLOR: #008080">88</span> <span style="COLOR: #000000">                display.sleep();<br /></span><span style="COLOR: #008080">89</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">90</span> <span style="COLOR: #000000">        image.dispose();<br /></span><span style="COLOR: #008080">91</span> <span style="COLOR: #000000">        display.dispose();<br /></span><span style="COLOR: #008080">92</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">93</span> <span style="COLOR: #000000">}</span></div>
<img src ="http://www.blogjava.net/vip01/aggbug/90127.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2006-12-26 15:47 <a href="http://www.blogjava.net/vip01/archive/2006/12/26/90127.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>获取当前绝对路径</title><link>http://www.blogjava.net/vip01/archive/2006/12/26/90094.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Tue, 26 Dec 2006 06:00:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2006/12/26/90094.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/90094.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2006/12/26/90094.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/90094.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/90094.html</trackback:ping><description><![CDATA[
		<p>    这个也是以前写的一点东西，今天要用，又扒出来了。希望能给大家带来帮助：<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> GetPath {<br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) {<br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">        GetPath test </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> GetPath();<br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">        System.out.println(test.getPath());<br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">    <br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String getPath() {<br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.getClass().getResource(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).getPath();<br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">}<br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"></span></div>
<img src ="http://www.blogjava.net/vip01/aggbug/90094.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2006-12-26 14:00 <a href="http://www.blogjava.net/vip01/archive/2006/12/26/90094.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>for each 循环＋可变参数的小例子（JDK5）</title><link>http://www.blogjava.net/vip01/archive/2006/12/22/89461.html</link><dc:creator>交口称赞</dc:creator><author>交口称赞</author><pubDate>Fri, 22 Dec 2006 03:08:00 GMT</pubDate><guid>http://www.blogjava.net/vip01/archive/2006/12/22/89461.html</guid><wfw:comment>http://www.blogjava.net/vip01/comments/89461.html</wfw:comment><comments>http://www.blogjava.net/vip01/archive/2006/12/22/89461.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/vip01/comments/commentRss/89461.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/vip01/services/trackbacks/89461.html</trackback:ping><description><![CDATA[    今天整理以前的一些零碎代码，把一个for each 循环＋可变参数的小例子（JDK5）和大家分享一下<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img id="Codehighlighter1_27_731_Open_Image" onclick="this.style.display='none'; Codehighlighter1_27_731_Open_Text.style.display='none'; Codehighlighter1_27_731_Closed_Image.style.display='inline'; Codehighlighter1_27_731_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_27_731_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_27_731_Closed_Text.style.display='none'; Codehighlighter1_27_731_Open_Image.style.display='inline'; Codehighlighter1_27_731_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> VariableArgs </span><span id="Codehighlighter1_27_731_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_27_731_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img id="Codehighlighter1_70_223_Open_Image" onclick="this.style.display='none'; Codehighlighter1_70_223_Open_Text.style.display='none'; Codehighlighter1_70_223_Closed_Image.style.display='inline'; Codehighlighter1_70_223_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_70_223_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_70_223_Closed_Text.style.display='none'; Codehighlighter1_70_223_Open_Image.style.display='inline'; Codehighlighter1_70_223_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) </span><span id="Codehighlighter1_70_223_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_70_223_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        VariableArgs test </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> VariableArgs();<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        test.show(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        test.show(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">hermit</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        test.showObject(</span><span style="COLOR: #000000">123</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">hermit</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        test.addT(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img id="Codehighlighter1_263_394_Open_Image" onclick="this.style.display='none'; Codehighlighter1_263_394_Open_Text.style.display='none'; Codehighlighter1_263_394_Closed_Image.style.display='inline'; Codehighlighter1_263_394_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_263_394_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_263_394_Closed_Text.style.display='none'; Codehighlighter1_263_394_Open_Image.style.display='inline'; Codehighlighter1_263_394_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> show(String<img src="http://www.blogjava.net/images/dot.gif" />strings) </span><span id="Codehighlighter1_263_394_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_263_394_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(strings.length);<br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img id="Codehighlighter1_331_367_Open_Image" onclick="this.style.display='none'; Codehighlighter1_331_367_Open_Text.style.display='none'; Codehighlighter1_331_367_Closed_Image.style.display='inline'; Codehighlighter1_331_367_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_331_367_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_331_367_Closed_Text.style.display='none'; Codehighlighter1_331_367_Open_Image.style.display='inline'; Codehighlighter1_331_367_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(String str : strings) </span><span id="Codehighlighter1_331_367_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_331_367_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            System.out.print(str</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\t</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println();<br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img id="Codehighlighter1_440_582_Open_Image" onclick="this.style.display='none'; Codehighlighter1_440_582_Open_Text.style.display='none'; Codehighlighter1_440_582_Closed_Image.style.display='inline'; Codehighlighter1_440_582_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_440_582_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_440_582_Closed_Text.style.display='none'; Codehighlighter1_440_582_Open_Image.style.display='inline'; Codehighlighter1_440_582_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> showObject(Object<img src="http://www.blogjava.net/images/dot.gif" />objects) </span><span id="Codehighlighter1_440_582_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_440_582_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(objects.length);<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img id="Codehighlighter1_508_555_Open_Image" onclick="this.style.display='none'; Codehighlighter1_508_555_Open_Text.style.display='none'; Codehighlighter1_508_555_Closed_Image.style.display='inline'; Codehighlighter1_508_555_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_508_555_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_508_555_Closed_Text.style.display='none'; Codehighlighter1_508_555_Open_Image.style.display='inline'; Codehighlighter1_508_555_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(Object obj : objects) </span><span id="Codehighlighter1_508_555_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_508_555_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            System.out.print(obj.toString()</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\t</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println();<br /></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img id="Codehighlighter1_615_727_Open_Image" onclick="this.style.display='none'; Codehighlighter1_615_727_Open_Text.style.display='none'; Codehighlighter1_615_727_Closed_Image.style.display='inline'; Codehighlighter1_615_727_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_615_727_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_615_727_Closed_Text.style.display='none'; Codehighlighter1_615_727_Open_Image.style.display='inline'; Codehighlighter1_615_727_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> addT(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/dot.gif" />obj) </span><span id="Codehighlighter1_615_727_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_615_727_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(obj.length);<br /></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> rs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img id="Codehighlighter1_684_698_Open_Image" onclick="this.style.display='none'; Codehighlighter1_684_698_Open_Text.style.display='none'; Codehighlighter1_684_698_Closed_Image.style.display='inline'; Codehighlighter1_684_698_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_684_698_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_684_698_Closed_Text.style.display='none'; Codehighlighter1_684_698_Open_Image.style.display='inline'; Codehighlighter1_684_698_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> x : obj) </span><span id="Codehighlighter1_684_698_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_684_698_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            rs</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">x;<br /></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(rs);<br /></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><img src ="http://www.blogjava.net/vip01/aggbug/89461.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/vip01/" target="_blank">交口称赞</a> 2006-12-22 11:08 <a href="http://www.blogjava.net/vip01/archive/2006/12/22/89461.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>