- Products
- ZShogi
- PyZume
- Download
- Let's try
- MakeGame
- MakePuzzle
- Links
-
www.zope.org/Members/owa
-
www.coreblog.org
-
www.python.org
-
www.zope.org
|
This is a simple applet with java.awt class.
Source
//
// AppletTest.java: Simple Applet with AWT class.
//
//<applet height=220 width=220 code="AppletTest.class">
// <param name="location" value="http://owa.as.wakwak.ne.jp/owa/arch/games/">
// <param name="gameid" value="R14_5">
// <p>applet is disable</p>
//</applet>
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.URL;
public class AppletTest extends Applet implements ActionListener {
String location;
String gameid;
int sequence = 0;
Image image;
Button btn_next;
public void init(){
location = getParameter("location");
gameid = getParameter("gameid");
setImage();
setBackground(Color.white);
setFont(new Font("Serif", Font.BOLD, 14));
btn_next = new Button("Next Move");
this.add(btn_next);
btn_next.addActionListener(this);
}
public void paint(Graphics g) {
g.drawImage(image, 0, 35, Color.white, this);
}
public void update(Graphics g) {
paint(g);
}
public void actionPerformed(ActionEvent e) {
this.sequence++;
setImage();
this.repaint();
}
public void setImage(){
String seq = "/show?seq=" + (new Integer(sequence).toString());
try {
URL u = new URL(location + gameid + seq);
image = getImage(u);
}
catch (java.net.MalformedURLException e) {
System.out.println("caught java.net.MalformedURLException");
}
catch (java.lang.Exception e) {
System.out.println("caught java.lang.Exception");
}
finally {
}
}
}
|