Back to index

plt-scheme  4.2.1
SillyCanvas.java
Go to the documentation of this file.
00001 package draw;
00002 
00003 import geometry.*;
00004 import colors.*;
00005 
00006 public class SillyCanvas extends Canvas {
00007   private int x = 20; 
00008   private int y = 20; 
00009   
00010   private boolean warning() {
00011     return super.drawString(new Posn(x,y),"This is a Dummy Canvas.");
00012   }
00013   
00014   SillyCanvas(int w, int h) { 
00015     super(w,h); 
00016     if ((w < x) || (h < y)) 
00017     throw new RuntimeException("SillyCanvas: bad size");
00018   }
00019   
00020   public boolean drawCircle(Posn p, int r, IColor c) {
00021     return super.drawCircle(p,r,c) && warning(); 
00022   }
00023   
00024   public boolean drawDisk(Posn p, int r, IColor c) {
00025     return super.drawDisk(p,r,c) && warning(); 
00026   }
00027   
00028   public boolean drawRect(Posn p, int width, int height, IColor c) {
00029     return super.drawRect(p,width,height,c) && warning(); 
00030   }
00031   
00032   public boolean drawLine(Posn p0, Posn p1, IColor c) {
00033     return super.drawLine(p0,p1,c) && warning();
00034   }
00035   
00036   public boolean drawString(Posn p, String s) { 
00037     return super.drawString(p,s) && warning(); 
00038   }
00039   
00040   public boolean show() {
00041     return super.show() && warning(); 
00042   }
00043 }