예제 #1
0
    protected void paintComponent(Graphics g) {
      super.paintComponent(g); // paints the background and image

      // If currentRect exists, paint a box on top.
      if (currentRect != null) {
        // Draw a rectangle on top of the image.
        g.setXORMode(Color.white); // Color of line varies
        // depending on image colors
        g.drawRect(rectToDraw.x, rectToDraw.y, rectToDraw.width - 1, rectToDraw.height - 1);

        controller.updateLabel(rectToDraw);
      }
    }