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

📄 ch03s05.html

📁 优秀的java程序开发软件方式与方法,对大家开发程序的时候有指导性帮助
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head>      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">   <title>5.&nbsp;&#32593;&#32476;&#29256;&#29468;&#25968;&#23383;&#28216;&#25103;</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"><link rel="start" href="index.html" title="Java&#32593;&#32476;&#31243;&#24207;&#21592;&#30475;Continuation"><link rel="up" href="ch03.html" title="Chapter&nbsp;3.&nbsp;Seaside&#26694;&#26550;"><link rel="prev" href="ch03s04.html" title="4.&nbsp;&#37096;&#20214;&#20043;&#38388;&#30340;call&#21644;answer"><link rel="next" href="ch04.html" title="Chapter&nbsp;4.&nbsp;Continuation&#30340;&#23454;&#29616;"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.&nbsp;&#32593;&#32476;&#29256;&#29468;&#25968;&#23383;&#28216;&#25103;</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Seaside&#26694;&#26550;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e388"></a>5.&nbsp;&#32593;&#32476;&#29256;&#29468;&#25968;&#23383;&#28216;&#25103;</h2></div></div></div><p>&#30475;&#36807;&#20102;&#31616;&#21333;&#30340;call/answer&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#29616;&#22312;&#26469;&#37325;&#26032;&#20889;&#26412;&#25991;&#24320;&#22836;&#30340;&#29468;&#25968;&#23383;&#28216;&#25103;&#65292;&#30475;&#30475;continuation&#21487;&#20197;&#36798;&#21040;&#24590;&#26679;&#30340;&#25928;&#26524;&#12290;</p><p>&#25105;&#20204;&#39318;&#20808;&#20889;&#19968;&#20010;WAComponent&#30340;&#23376;&#31867;WANumberInput&#65292;&#29992;&#26469;&#21521;&#29992;&#25143;&#35810;&#38382;&#19968;&#20010;&#25968;&#23383;&#12290;&#27880;&#24847;&#36825;&#20010;&#37096;&#20214;&#23436;&#20840;&#19981;&#29992;&#29702;&#20250;&#29468;&#25968;&#23383;&#36825;&#20010;&#28216;&#25103;&#65292;&#25152;&#20197;&#23427;&#20250;&#24456;&#23481;&#26131;&#37325;&#22797;&#20351;&#29992;&#12290;</p><pre class="programlisting">WAComponent subclass: #WANumberInput    instanceVariableNames: 'number'    classVariableNames: ''    poolDictionaries: ''    category: 'Seaside-Examples-Test'</pre><p>&#35813;&#31867;&#26377;&#19977;&#20010;&#26041;&#27861;&#65292;&#20998;&#21035;&#22914;&#19979;&#65306;</p><pre class="programlisting">number    ^ numbernumber: aNumber    number _ aNumberrenderContentOn: html    html form: [        html textInputOn: #number of: self.        html submitButtonWithAction:             [self answer: number] text: 'Return']</pre><p>&#29992;&#31867;&#20284;Java&#30340;&#35821;&#27861;&#20889;&#20986;&#26469;&#23601;&#26159;&#65306;&#65288;&#19979;&#38754;&#30340;&#20195;&#30721;&#19981;&#26159;&#20219;&#20309;&#35821;&#35328;&#65289;</p><pre class="programlisting">public class WANumberInput extends WAComponent{    private Object number;    public Object getNumber() {        return number;    }    public void setNumber(Object aNumber) {        number = aNumber;    }    public void renderContentOn(Object html) {        html.beginForm();        html.textInput();         // &#35813;textInput&#19982;this.number&#30456;&#32852;&#31995;        html.submitButton(&#8216;Return&#8217;);        // &#29992;onButtonClicked&#20989;&#25968;&#22788;&#29702;button click&#20107;&#20214;        html.endForm();    }    public void onButtonClicked() {        this.answer(number);    }}</pre><p>&#35813;&#37096;&#20214;&#30340;&#20316;&#29992;&#26159;&#26174;&#31034;&#19979;&#38754;&#30340;&#39029;&#38754;&#12290;&#24403;&#29992;&#25143;&#25353;&#19979;Return&#38190;&#26102;&#65292;&#35813;&#37096;&#20214;&#20250;answer&#35843;&#29992;&#33258;&#24049;&#30340;&#37096;&#20214;&#65292;&#24182;&#23558;&#29992;&#25143;&#30340;&#36755;&#20837;&#20316;&#20026;&#36820;&#22238;&#20540;&#12290;</p><div class="screenshot"><div class="mediaobject"><img src="resources/number-input.png"></div></div><p>&#24456;&#31616;&#21333;&#65292;&#24456;&#24178;&#20928;&#30340;&#19968;&#20010;&#37096;&#20214;&#65292;&#19981;&#26159;&#21527;&#65311;&#29616;&#22312;&#25105;&#20204;&#30475;&#30475;&#22914;&#20309;&#20351;&#29992;&#23427;&#12290;&#25105;&#20204;&#26032;&#21019;&#24314;&#19968;&#20010;WATask&#30340;&#23376;&#31867;&#65292;WAGuessNum&#12290;</p><pre class="programlisting">WATask subclass: #WAGuessNum    instanceVariableNames: ''    classVariableNames: ''    poolDictionaries: ''    category: 'Seaside-Examples-Test'</pre><p>WATask&#26412;&#36523;&#26159;WAComponent&#30340;&#19968;&#20010;&#23376;&#31867;&#65292;&#23427;&#26159;WAComponent&#26368;&#37325;&#35201;&#30340;&#23376;&#31867;&#20043;&#19968;&#12290;&#19982;&#26222;&#36890;&#30340;WAComponent&#19981;&#21516;&#65292;WATask&#27809;&#26377;renderContentOn&#20989;&#25968;&#65292;&#19981;&#36807;&#23427;&#26377;&#21478;&#19968;&#20010;&#20989;&#25968;go&#12290;WATask&#20174;&#26469;&#19981;&#26174;&#31034;&#33258;&#24049;&#65292;&#20063;&#23601;&#26159;&#35828;&#65292;&#23427;&#20250;&#19968;&#30452;call&#20854;&#23427;&#37096;&#20214;&#65292;&#19968;&#20010;&#37096;&#20214;answer&#21518;&#23427;&#20250;&#31435;&#21363;call&#21478;&#19968;&#20010;&#37096;&#20214;&#12290;WATask&#33258;&#36523;&#21482;&#36127;&#36131;&#36923;&#36753;&#32780;&#19981;&#26159;&#26174;&#31034;&#12290;</p><p>&#25105;&#20204;&#30340;WAGuessNum&#21482;&#26377;&#19968;&#20010;instance method&#65292;&#20063;&#23601;&#26159;go&#12290;&#20195;&#30721;&#22914;&#19979;&#65306;</p><pre class="programlisting">go    | answer win guess numinput |    answer _ Random new nextInt: 100.    win _ false.

⌨️ 快捷键说明

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