protected void paint(Graphics graphics) {
    super.paint(graphics);

    if (currentFrame != 0) {
      graphics.drawImage(
          image.getFrameLeft(currentFrame),
          image.getFrameTop(currentFrame),
          image.getFrameWidth(currentFrame),
          image.getFrameHeight(currentFrame),
          image,
          currentFrame,
          0,
          0);
    }
  }
Пример #2
0
  protected void paint(Graphics graphics) {
    // Call super.paint. This will draw the first background
    // frame and handle any required focus drawing.
    super.paint(graphics);

    // Don't redraw the background if this is the first frame.
    if (_currentFrame != 0) {
      // Draw the animation frame.
      graphics.drawImage(
          _image.getFrameLeft(_currentFrame),
          _image.getFrameTop(_currentFrame),
          _image.getFrameWidth(_currentFrame),
          _image.getFrameHeight(_currentFrame),
          _image,
          _currentFrame,
          0,
          0);
    }
  }