Draws this rectangle using the AWT drawing API. Required to implement the Drawable interface. @param panel DrawingPanel @param g Graphics
(DrawingPanel panel, Graphics g)
| 49 | * @param g Graphics |
| 50 | */ |
| 51 | public void draw(DrawingPanel panel, Graphics g) { |
| 52 | g = g.create(); |
| 53 | left = control.getInt("xleft"); |
| 54 | top = control.getInt("ytop"); |
| 55 | // Shape clipShape = g.getClip(); |
| 56 | System.out.println("PixelRectangle setting clip..."); |
| 57 | g.setClip(0, 0, panel.getWidth(), panel.getHeight()); |
| 58 | // this method implements the Drawable interface |
| 59 | System.out.println("PixelRectangle filling..."); |
| 60 | g.setColor(Color.RED); // set drawing color to red |
| 61 | g.fillRect(left, top, width, height); // draws rectangle |
| 62 | System.out.println("PixelRectangle disposing..."); |
| 63 | g.dispose(); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /* |