code: private void drawBorder(Graphics2D g, int width, int height, Color color, float size) {
          int max        = (int) (Math.min((height - 2) * size, height / 2.0f) + 0.5);
          int alphaDelta = color.getAlpha() / max;
  
          for (int i = 0; i < max; i++) {
              Shape s        = shapeGenerator.createRoundRectangle(i, i, width - 2 * i - 1, height - 2 * i - 1, CornerSize.CHECKBOX_INTERIOR);
              Color newColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() - i * alphaDelta);
  
              g.setPaint(newColor);
              g.draw(s);
          }
      }
docs: Draw a border around the graphic.
  
  @param g      the Graphic context.
  @param width  the width of the border.
  @param height the height of the border.
  @param color  the color of the border.
  @param size   the spread of the border from outside in, expressed as a
  percentage of the height.