SwingCanvas implements RSCanvas { public void drawRect(int left, int top, int right, int bottom, RSPaint paint) { SwingPaint p = (SwingPaint) paint; g.setColor(p.color); g.setStroke(p.stroke); int width = (right - left); int height = (bottom - top); switch (((SwingPaint)paint).paintStyle) { case FILL: g.fillRect(left, top, width, height); break; case FILL_AND_STROKE: g.fillRect(left, top, width, height); g.drawRect(left, top, width, height); break; case STROKE: g.drawRect(left, top, width, height); break; } } SwingCanvas(Component canvas, Graphics g); void drawLine(int left, float y, int right, float y2,
			RSPaint gridPaint); void drawPath(RSPath path, RSPaint strokePaint); void drawRect(int left, int top, int right, int bottom,
			RSPaint paint); RSRect getClipBounds();  }
@Test public void testDrawRect() throws InterruptedException, InvocationTargetException { painter = new Painter() { @Override public void paint(SwingCanvas canvas) { RSRect r = canvas.getClipBounds(); r.left += 20; r.top += 20; r.right -= 20; r.bottom -= 20; canvas.drawRect(r.left, r.top, r.right, r.bottom, paint); } }; uiLiaison.repaint(); Thread.sleep(5000); }