private void drawBtnStyle(Graphics gfx) {
    final int initialColor = gfx.getColor();

    // draw border
    gfx.setColor(0x424242);
    gfx.drawLine(w - 1, 0, w - 1, h - 3);
    gfx.drawLine(0, h - 1, w - 1, h - 1);

    gfx.setColor(Color.BLACK);
    gfx.drawLine(w - 2, 0, w - 2, h - 2);
    gfx.drawLine(0, h - 2, w - 1, h - 2);

    gfx.setColor(initialColor);

    // corners are equal in size, so we can use just one value for both corners
    final int cornerWidth = BTN_STYLE_LEFT_CORNER.getWidth();
    final int middleWidth = w - 2 * cornerWidth - 2;

    // height is equal for all three pieces
    final int height = BTN_STYLE_LEFT_CORNER.getHeight();

    // draw left corner
    gfx.drawBitmap(0, 0, cornerWidth, height, BTN_STYLE_LEFT_CORNER, 0, 0);

    final EncodedImage middle = ImageUtils.resize(BTN_STYLE_MIDDLE, middleWidth + 1, height, false);

    // draw middle
    gfx.drawImage(cornerWidth, 0, middleWidth, height, middle, 0, 0, 0);

    // draw right corner
    gfx.drawBitmap(cornerWidth + middleWidth, 0, cornerWidth, height, BTN_STYLE_RIGHT_CORNER, 0, 0);
  }
  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);
    }
  }
  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);
    }
  }