code: private static void paintRegion(SynthContext state, Graphics g, Rectangle bounds) {
          JComponent c      = state.getComponent();
          SynthStyle style  = state.getStyle();
          int        x;
          int        y;
          int        width;
          int        height;
  
          if (bounds == null) {
              x      = 0;
              y      = 0;
              width  = c.getWidth();
              height = c.getHeight();
          } else {
              x      = bounds.x;
              y      = bounds.y;
              width  = bounds.width;
              height = bounds.height;
          }
  
          // Fill in the background, if necessary.
          boolean subregion = state.getRegion().isSubregion();
  
          if ((subregion && style.isOpaque(state)) || (!subregion && c.isOpaque())) {
              g.setColor(style.getColor(state, ColorType.BACKGROUND));
              g.fillRect(x, y, width, height);
          }
      }
docs: Paint a region.
  
  @param state  the SynthContext describing the current component, region,
  and state.
  @param g      the Graphics context used to paint the subregion.
  @param bounds the bounds to paint in.