⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 builder_course_104_1_gjbc.html

📁 Java应 用 教 程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
        resize(150,60);<br>
        setLayout(new FlowLayout( )); // 使 用 FlowLayout 外 观 管 理 器<br>

        add(&quot;East&quot;,new Button(&quot; 东 边 &quot;));<br>
        add(&quot;West&quot;,new Button(&quot; 西 边 &quot;));<br>
        add(&quot;South&quot;,new Button(&quot; 南 边 &quot;));<br>
        add(&quot;North&quot;,new Button(&quot; 北 边 &quot;));<br>
        add(&quot;Center&quot;,new Button(&quot; 中 央 &quot;));<br>
                    }<br>
    }<br>
<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
程 序 14.3 的 运 行 结 果 如 图 14.4 所 示 :<br>
<img src="../images/java30.gif" tppabs="http://www.chinabyte.com/builder/images/java30.gif" width="158" height="130" align="left" vspace="10" hspace="10" border="0"><br>

图 14.4 程 序 14.3 的 执 行 结 果
<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
实 际 上 , 如 果 我 们 把 程 序 中 的 setLayout (new FlowLayout( )); 这 条 语 句 去 掉 , 程 序 的 执 行 结 果 也 是 一 样 的 , 没 有 任 何 区 别 。 这 是 因 为 FlowLayout 外 观 管 理 器 是 默 认 的 外 观 管 理 器 的 缘 故 。 有 兴 趣 的 人 可 以 自 己 试 一 试 。
如 果 我 们 改 变 语 句<br>
        resize(150,60);<br>
为 :<br>
        resize(300,60);<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
则 程 序 运 行 结 果 如 图 14.5 :<br>

<img src="../images/java31.gif" tppabs="http://www.chinabyte.com/builder/images/java31.gif" width="302" height="88" align="left" vspace="10" hspace="10" border="0"><br>

图 14.5 改 变 后 的 程 序 14.3 的 执 行 结 果
<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
我 们 从 以 上 的 程 序 运 行 结 果 可 以 进 一 步 看 出 , 当 窗 口 之 中 的 组 件 不 能 排 满 一 排 的 时 候 , 组 件 是 按 照 向 中 间 对 齐 的 原 则 来 排 列 的 。
<img src="../images/java6.gif" tppabs="http://www.chinabyte.com/builder/images/java6.gif" width="130" height="158" align="left" vspace="10" hspace="10" border="0">

向 中 间 对 齐 是 默 认 的 对 齐 规 则 。
<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
对 齐 方 式 是 可 以 改 变 的 :<br>
<ul>
<li>使 用 FlowLayout.LEFT 可 以 使 得 组 件 们 向 左 边 对 齐
<li>使 用 FlowLayout.RIGHT 可 以 使 得 组 件 们 向 右 边 对 齐
<li>使 用 FlowLayout.CENTER 可 以 使 得 组 件 们 向 中 间 对 齐 ( 也 就 是 默 认 的 对 齐 方 式 )
</ul>
<p>    
我 们 把 上 面 语 句 之 中 的 setLayout(new FlowLayout( ));
改 为 :<br>
        setLayout(new FlowLayout(FlowLayout.LEFT));<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
程 序 运 行 结 果 就 会 如 下 所 示 ( 图 14.6 ) :<br>

<img src="../images/java32.gif" tppabs="http://www.chinabyte.com/builder/images/java32.gif" width="308" height="96" align="left" vspace="10" hspace="10" border="0"><br>

图 14.6 进 一 步 改 变 后 的 程 序 14.3 的 执 行 结 果<p>

<img src="../images/java9.gif" tppabs="http://www.chinabyte.com/builder/images/java9.gif" width="56" height="64" align="left" vspace="10" hspace="10" border="0">
   
那 么 , 使 用 了 语 句 setLayout(new FlowLayout(FlowLayout.RIGHT)); 以 后 , 窗 口 会 变 成 什 么 样 子 呢 ?
这 个 问 题 留 着 大 家 自 己 编 个 程 序 试 一 试 吧 。 好 吗 ?
<p><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" width="30" height="1" border="0">
<p>






<center>



第1页 





<a href="builder_course_104_2_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_104_2_GJBC.html">第2页</a> 





<a href="builder_course_104_3_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_104_3_GJBC.html">第3页</a> 

<a href="builder_course_104_2_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_104_2_GJBC.html">下一页</a>

</center>
<p><hr>
</td>
</tr>

<tr>
<td width="400" align="left" valign="top"><br>


<b>参 考 文 章 : </b><br>

<font class="a">1. <a href="builder_course_112_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_112_1_GJBC.html">Java应 用 教 程 (八 )—— 例 外 处 理</a> ( 1998-09-02 )</font><br>

<font class="a">2. <a href="builder_course_111_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_111_1_GJBC.html">Java应 用 教 程 (七 )—— Java的 网 络 功 能</a> ( 1998-08-03 )</font><br>

<font class="a">3. <a href="builder_course_110_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_110_1_GJBC.html">Java应 用 教 程 (六 )—— 终 于 动 起 来 了</a> ( 1998-07-03 )</font><br>

<font class="a">4. <a href="builder_course_109_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_109_1_GJBC.html">Java应 用 教 程 (五 )—— 交 互 的 Java世 界</a> ( 1998-05-08 )</font><br>

<font class="a">5. <a href="builder_course_108_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_108_1_GJBC.html">Java应 用 教 程 (四 )—— 五 彩 缤 纷 的 世 界</a> ( 1998-03-11 )</font><br>

<font class="a">6. <a href="builder_course_105_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_105_1_GJBC.html">Java应 用 教 程 (三 )—— 漂 亮 的 标 语</a> ( 1998-01-27 )</font><br>

<font class="a">7. <a href="builder_course_100_1_GJBC.html" tppabs="http://www.chinabyte.com/staticpages/builder/builder_course/GJBC/builder_course_100_1_GJBC.html">Java应 用 教 程  (一)——美 丽 的 窗 口</a> ( 1997-11-04 )</font><br>

</td>

<td width="20"><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" border="0" width="20" height="1">
</td>

<td width="204" align="left" valign="top"><br>
<font class="a">
如 果 您 认 为 这 篇 文 章 还 不 错 , 欢 迎 您 向 其 他 读 者 推 荐 ; 如 果 您 认 为 这 篇 文 章 水 平 太 差 , 欢 迎 您 <a href="mailto:buildermaster@chinabyte.com">发 表 高 见</a> 。</font>
</td>
</tr>
</table>
<p>


<table border="0" cellspacing="0" cellpadding="0" bgcolor="#980018">
  <tr>
<td bgcolor="ffffff"><img src="../main/images/b_left.gif" tppabs="http://www.chinabyte.com/images/b_left.gif" border="0" WIDTH="19" HEIGHT="27"></td>
    

    
    <td>
    
    <a href="../tppmsgs/msgs2.htm#250" tppabs="http://www.chinabyte.com/staticpages/feedback/feedback_home/feedback/feedback_home_1.html" onMouseOver="window.status = '服务台'; return true "><img src="../main/images/99feedback.gif" tppabs="http://www.chinabyte.com/images/99feedback.gif" border="0" alt="服务台" WIDTH="39" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td>
    <a href="../tppmsgs/msgs2.htm#251" tppabs="http://www.chinabyte.com/staticpages/siteinfo/siteinfo_mapind/siteinfo/siteinfo_mapind_1.html" onMouseOver="window.status = '站导图'; return true "><img src="../main/images/99site.gif" tppabs="http://www.chinabyte.com/images/99site.gif" border="0" alt="站导图" WIDTH="38" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td>
    <a href="../tppmsgs/msgs2.htm#252" tppabs="http://www.chinabyte.com/feedback/about_chinabyte.html" onMouseOver="window.status = '关于本站'; return true "><img src="../main/images/99about.gif" tppabs="http://www.chinabyte.com/images/99about.gif" border="0" alt="关于本站" WIDTH="52" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td width="131" bgcolor="#980018"><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" border="0" width="1" height="1"></td>
    <td><a HREF="../tppmsgs/msgs2.htm#200" tppabs="http://www.chinabyte.com/staticpages/digest/digest_home/digest/digest_home_1.html" onMouseOver="window.status = '及时传送IT产业新闻'; return true" target="_top"><img src="../main/images/99news.gif" tppabs="http://www.chinabyte.com/images/99news.gif" border="0" alt="新闻总线" WIDTH="53" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td><a HREF="../tppmsgs/msgs2.htm#202" tppabs="http://www.chinabyte.com/staticpages/software/software_home/software/software_home_1.html" onMouseOver="window.status = '漫步免费软件仓库'; return true" target="_top"><img src="../main/images/99soft.gif" tppabs="http://www.chinabyte.com/images/99soft.gif" border="0" alt="软件仓库" WIDTH="52" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td><a HREF="../tppmsgs/msgs2.htm#204" tppabs="http://www.chinabyte.com/staticpages/builder/builder_home/builder/builder_home_1.html" onMouseOver="window.status = '在线专业培训'; return true" target="_top"><img src="../main/images/99_builder.gif" tppabs="http://www.chinabyte.com/images/99_builder.gif" border="0" alt="网络学院" WIDTH="52" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
    <td><a HREF="../tppmsgs/msgs2.htm#213" tppabs="http://www.chinabyte.com/staticpages/gamecen/gamecen_home/gamecen/gamecen_home_1.html" onMouseOver="window.status = '游戏玩家的乐园'; return true" target="_top"><img src="../main/images/99game.gif" tppabs="http://www.chinabyte.com/images/99game.gif" border="0" alt="游戏天堂" WIDTH="52" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
  <td><a HREF="../tppmsgs/msgs2.htm#214" tppabs="http://www.chinabyte.com/staticpages/digital/digital_home/digital/digital_home_1.html" onMouseOver="window.status = '数字世界'; return true" target="_top"><img src="../main/images/99digital.gif" tppabs="http://www.chinabyte.com/images/99digital.gif" border="0" alt="数字世界" WIDTH="53" HEIGHT="27"></a><img src="../main/images/b_1.gif" tppabs="http://www.chinabyte.com/images/b_1.gif" WIDTH="10" HEIGHT="27"><img src="../main/images/b_2.gif" tppabs="http://www.chinabyte.com/images/b_2.gif" WIDTH="11" HEIGHT="27"></td>
<td width="30"><img src="../main/images/blank.gif" tppabs="http://www.chinabyte.com/images/blank.gif" border="0" width="1" height="1"></td>

    
  </tr>
 
</table>

<center><table>
  <tr>
    <td align="center"><br><font size="-2">
     <b>ChinaByte</b>版 权 所 有, 未 经 授 权 禁 止 复 制 或 建 立 镜 像。<br>
     如 果 您 有 什 么 问 题, 请 发 <a href="mailto:webmaster@chinabyte.com">电 子 邮 件</a> 给 我 们。 谢 谢! </font>
    </td>
  </tr>
</table></center>

<!--msnavigation--></td></tr><!--msnavigation--></table></body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -