Java Applet:

將JAVA內嵌在html中

所以一個JAVA Applet = java code + html

在html中使用applet label

Ex:
//傳遞參數


JAVA Applet中的java code沒有main function

而是以init()取代

Ex:
public class Lottery extends JApplet implements ActionListener
{
Input in = new Input();

public void init()
{
JButton button = new JButton("樂透選號碼 42選6");
getContentPane().add(button);
button.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(!in.isVisible()) in.setVisible(true);
else in.show();
}
}

其實就是Swing的延伸

但是JAVA Applet需要在瀏覽器執行

在local端測試方式:
1.產生class檔
2.appletviewer XXX.html

arrow
arrow
    全站熱搜

    flyinsky76 發表在 痞客邦 留言(0) 人氣()