Beispiel #1
0
  /**
   * Paint the contents of the canvas.
   *
   * <p>Never called by you directly, instead called by Java runtime when area of screen covered by
   * this container needs to be displayed (i.e., creation, uncovering, change in status)
   *
   * @param pen used to paint shape on the screen
   */
  @Override
  public void paintComponent(Graphics pen) {
    pen.setColor(myBackgroundColor);
    pen.fillRect(0, 0, getSize().width, getSize().height);
    pen.drawImage(myBackground, 0, 0, getSize().width, getSize().height, null);

    if (myGridShowing) {
      myGrid.paint((Graphics2D) pen);
    }
    myWorkspace.paintDataSource((Graphics2D) pen);
  }