racket/collects/htdch/Examples/blink-java.ss
Eli Barzilay 7d50e61c7f * Newlines at EOFs
* Another big chunk of v4-require-isms
* Allow `#lang framework/keybinding-lang' for keybinding files
* Move hierlist sources into "mrlib/hierlist", leave stub behind

svn: r10689
2008-07-09 07:18:06 +00:00

46 lines
806 B
Scheme

import geometry.*;
import colors.*;
import draw.*;
class A extends World {
Posn O = new Posn(10,25);
Posn OO = new Posn(0,0);
IColor RED = new Red();
String s;
A(String s) {
this.s = s;
}
boolean go() {
return bigBang(50,50,1);
}
World onTick() {
if (s.equals("hello")) {
return new A("world"); }
else {
return new A("hello"); }
}
World onKeyEvent(String key) {
if (key.equals("x")) {
return new A("bye"); }
else {
return this; }
}
boolean draw() {
return this.theCanvas.drawRect(OO,50,50,RED)
&& this.theCanvas.drawString(O,s);
}
}
class Examples {
Posn p = new Posn(10,20);
IColor c = new Red();
Examples() { }
boolean b = check this.p.x expect 10;
boolean a = new A("hello").go();
}