| This example shows how to write an applet in a web page that has a Goban and some stones. If nothing appears on the left, make sure that Java is installed and enabled. The source code is shown below. |
package com.joot.jigo.examples;
import com.joot.jigo.Goban;
import com.joot.jigo.Stone;
import com.joot.jigo.Point;
import com.joot.jigo.WhiteStone;
import java.awt.Color;
/**
* Creates a Goban with three stones. This is perhaps the simplest task
* you could possibly desire -- the equivalent of "Hello, World!"
*/
public class Simple extends java.applet.Applet {
private Stone stone = new WhiteStone( 10, 12 );
private Goban goban = new Goban( 9, new Color( 184, 115, 51 ), stone );
public void init() {
Goban goban = getGoban();
Stone stone = getStone();
goban.setHoshiPixelSize( 4 );
goban.placeStone( stone, new Point( 0, 0 ) );
goban.placeStone( stone, new Point( 4, 4 ) );
goban.placeStone( stone, new Point( 8, 8 ) );
// Make sure the Goban appears in the browser.
//
add( goban );
}
protected Goban getGoban() {
return goban;
}
protected Stone getStone() {
return stone;
}
}
© 2010 White Magic Software, Ltd.