if (width > imageWidth || height > imageHeight)
if (width > imageWidth || height > imageHeight) {
  paint(Image image, Rectangle r, Graphics g, ImageObserver c) {    if (c == null) { return; }    if (r == null) { return; }    if (g == null) { return; }    if (image == null) { return; }     Rectangle cachedClip = g.getClipBounds();    if (cachedClip == null) {      //  System.err.println("null clip! returning");      return;      //  try { throw (new Exception()); }      //  catch (Exception e) { e.printStackTrace(); }    }     boolean tiling;     int width = r.width;    int height = r.height;    int imageWidth = PatternMaker.getWidth();    int imageHeight = PatternMaker.getHeight();     if (width > imageWidth || height > imageHeight)      tiling = true;    else      tiling = false;     g.setClip(r.x+1, r.y+1, r.width-1,r.height-1);     if (tiling) {      int wCount = Math.max(Math.round(width/imageWidth)+1, 1);      int hCount = Math.max(Math.round(height/imageHeight)+1, 1);       // tile in images here...      for (int x = 0; x < wCount; x++) {	for (int y = 0; y < hCount; y++) {	  g.drawImage(image, r.x + x*imageWidth, r.y + y*imageHeight,		      imageWidth,imageHeight,c);	}      }      // System.err.println("tiled h:" + hCount+ " w:" + wCount);    }    else {      g.drawImage(image,r.x,r.y,imageWidth,imageHeight,c);    }     // restore clip    g.setClip(cachedClip.x, cachedClip.y, cachedClip.width,cachedClip.height);  }