Example #1
0
  /* Draws the ball at its current position */
  public void draw(Graphics2D g) {
    double imageWidth = img.getWidth(parent);
    double imageHeight = img.getHeight(parent);

    // translate image such that its centred on its actual position
    objectTransform.setToTranslation(
        (double) pos_x - imageWidth / 2, (double) pos_y - imageHeight / 2);

    // 	// this rotates the planet!
    // 	objectTransform.rotate(Math.PI/800,50.0,51.0);

    g.setTransform(new AffineTransform());
    g.drawImage(img, objectTransform, parent);
  }