@Override
    public void paint(Graphics2D graphics) {
      // Apply scroll bar styles to the button
      ScrollButton scrollButton = (ScrollButton) getComponent();
      ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
      Orientation orientation = scrollBar.getOrientation();

      int width = getWidth();
      int height = getHeight();

      Color backgroundColor;
      if (scrollButton.isEnabled()) {
        if (pressed) {
          backgroundColor = scrollButtonPressedBackgroundColor;
        } else if (highlighted) {
          backgroundColor = scrollButtonHighlightedBackgroundColor;
        } else {
          backgroundColor = scrollButtonBackgroundColor;
        }
      } else {
        backgroundColor = scrollButtonDisabledBackgroundColor;
      }

      Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);

      // Paint the background
      Color gradientStartColor = pressed ? backgroundColor : brightBackgroundColor;
      Color gradientEndColor = pressed ? brightBackgroundColor : backgroundColor;

      if (orientation == Orientation.HORIZONTAL) {
        graphics.setPaint(
            new GradientPaint(0, 1, gradientStartColor, 0, height - 2, gradientEndColor));
      } else {
        graphics.setPaint(
            new GradientPaint(1, 0, gradientStartColor, width - 2, 0, gradientEndColor));
      }

      graphics.fillRect(1, 1, width - 2, height - 2);

      // Paint the border
      graphics.setPaint(borderColor);
      GraphicsUtilities.drawRect(graphics, 0, 0, width, height);

      // Determine the button image size
      ScrollButtonImage buttonImage = scrollButton.getButtonImage();
      int buttonImageWidth = buttonImage.getWidth();
      int buttonImageHeight = buttonImage.getHeight();

      // Paint the image
      Graphics2D imageGraphics = (Graphics2D) graphics.create();
      int buttonImageX = (width - buttonImageWidth) / 2;
      int buttonImageY = (height - buttonImageHeight) / 2;
      imageGraphics.translate(buttonImageX, buttonImageY);
      imageGraphics.clipRect(0, 0, buttonImageWidth, buttonImageHeight);
      buttonImage.paint(imageGraphics);
      imageGraphics.dispose();
    }