code: private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, int orientation) {
          Component c   = ctx.getComponent();
          boolean   ltr = c.getComponentOrientation().isLeftToRight();
  
          // Don't RTL flip JSpliders as they handle it internaly
          if (ctx.getComponent() instanceof JSlider)
              ltr = true;
  
          if (orientation == SwingConstants.VERTICAL && ltr) {
              AffineTransform transform = new AffineTransform();
  
              transform.scale(-1, 1);
              transform.rotate(Math.toRadians(90));
              paintBackground(ctx, g, y, x, h, w, transform);
          } else if (orientation == SwingConstants.VERTICAL) {
              AffineTransform transform = new AffineTransform();
  
              transform.rotate(Math.toRadians(90));
              transform.translate(0, -(x + w));
              paintBackground(ctx, g, y, x, h, w, transform);
          } else if (orientation == SwingConstants.HORIZONTAL && ltr) {
              paintBackground(ctx, g, x, y, w, h, null);
          } else {
  
              // horizontal and right-to-left orientation
              AffineTransform transform = new AffineTransform();
  
              transform.translate(x, y);
              transform.scale(-1, 1);
              transform.translate(-w, 0);
              paintBackground(ctx, g, 0, 0, w, h, transform);
          }
      }
docs: Paint the object's background.
  
  @param ctx         the SynthContext.
  @param g           the Graphics context.
  @param x           the x location corresponding to the upper-left
  coordinate to paint.
  @param y           the y location corresponding to the upper left
  coordinate to paint.
  @param w           the width to paint.
  @param h           the height to paint.
  @param orientation the component's orientation, used to construct an
  affine transform.