精華區beta GoodNews 關於我們 聯絡資訊
※ 引述《hotball (哲哲魚)》之銘言: : ※ 引述《Peny (Right here waiting)》之銘言: : : 如果要show的東東是要先在java算出來的東東, 那要怎麼show啊.... : A simple example: : <applet code="classname.class" width=300 height=200> : <param name="parameter1" value="value1"> : <param name="parameter2" value="value2"> : <hr> : Your browser does not support Java applet. : <hr> : </applet> : then the class'll have a 300x200 space on the screen, just like an : image. : In your applet, overrides "public void paint(Graphics g)" to show : anything you want on the applet panel. : Use getParameter(String name) to get the parameters. : For an example, use : String a = getParameter("parameter1"); : you should have a = "value1". 我的意思是比如說在作業一, random.java裡自己寫了一個函式SimulatePi(), 它會把PI值算出來, 但要如何在applet的那個screen把SimulatePi()的值show 出來.... 我在paint()用g.drawString(SimulatePi(),X,Y)不行, 不過後來我改成 g.drawString(""+SimulatePi()+"",X,Y)就可以了, 這種把函式值或變數值show 出來的方法會不會很怪, 還有其他方法嗎? -- ※ 發信站: 批踢踢實業坊(ptt.m8.ntu.edu.tw) ◆ From: dilemma.m6.ntu.