示例#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(Color.WHITE);
   pen.fillRect(0, 0, getSize().width, getSize().height);
   if (myGrid != null) {
     myGrid.paint((Graphics2D) pen);
   }
 }