There are 4 code examples for java.awt.geom.RectangularShape.

The API names are highlighted below. You can use button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Method Code:

```/**
* Creates a shadow for the bar.
* @param bar  the bar shape.
* @param xOffset  the x-offset for the shadow.
* @param yOffset  the y-offset for the shadow.
* @param base  the edge that is the base of the bar.
* @return A rectangle for the shadow.
*/
double x0=bar.getMinX();
double x1=bar.getMaxX();
double y0=bar.getMinY();
double y1=bar.getMaxY();
if (base == RectangleEdge.TOP) {
x0+=xOffset;
x1+=xOffset;
y0+=yOffset;
}
y1+=yOffset;
}
else   if (base == RectangleEdge.BOTTOM) {
x0+=xOffset;
x1+=xOffset;
y0+=yOffset;
y1+=yOffset;
}
}
else   if (base == RectangleEdge.LEFT) {
x0+=xOffset;
}
x1+=xOffset;
y0+=yOffset;
y1+=yOffset;
}
else   if (base == RectangleEdge.RIGHT) {
x0+=xOffset;
x1+=xOffset;
}
y0+=yOffset;
y1+=yOffset;
}
return new Rectangle2D.Double(x0,y0,(x1 - x0),(y1 - y0));
}
```

Method Code:

```/**
* Splits a bar into subregions (elsewhere, these subregions will have
* different gradients applied to them).
* @param bar  the bar shape.
* @param a  the first division.
* @param b  the second division.
* @param c  the third division.
* @return An array containing four subregions.
*/
private Rectangle2D[] splitHorizontalBar(RectangularShape bar,double a,double b,double c){
Rectangle2D[] result=new Rectangle2D[4];
double y0=bar.getMinY();
double y1=Math.rint(y0 + (bar.getHeight() * a));
double y2=Math.rint(y0 + (bar.getHeight() * b));
double y3=Math.rint(y0 + (bar.getHeight() * c));
result[0]=new Rectangle2D.Double(bar.getMinX(),bar.getMinY(),bar.getWidth(),y1 - y0);
result[1]=new Rectangle2D.Double(bar.getMinX(),y1,bar.getWidth(),y2 - y1);
result[2]=new Rectangle2D.Double(bar.getMinX(),y2,bar.getWidth(),y3 - y2);
result[3]=new Rectangle2D.Double(bar.getMinX(),y3,bar.getWidth(),bar.getMaxY() - y3);
return result;
}
```

Method Code:

```/**
* Splits a bar into subregions (elsewhere, these subregions will have
* different gradients applied to them).
* @param bar  the bar shape.
* @param a  the first division.
* @param b  the second division.
* @param c  the third division.
* @return An array containing four subregions.
*/
private Rectangle2D[] splitHorizontalBar(RectangularShape bar,double a,double b,double c){
Rectangle2D[] result=new Rectangle2D[4];
double y0=bar.getMinY();
double y1=Math.rint(y0 + (bar.getHeight() * a));
double y2=Math.rint(y0 + (bar.getHeight() * b));
double y3=Math.rint(y0 + (bar.getHeight() * c));
result[0]=new Rectangle2D.Double(bar.getMinX(),bar.getMinY(),bar.getWidth(),y1 - y0);
result[1]=new Rectangle2D.Double(bar.getMinX(),y1,bar.getWidth(),y2 - y1);
result[2]=new Rectangle2D.Double(bar.getMinX(),y2,bar.getWidth(),y3 - y2);
result[3]=new Rectangle2D.Double(bar.getMinX(),y3,bar.getWidth(),bar.getMaxY() - y3);
return result;
}
```

Method Code:

```/**
* Creates a shadow for the bar.
* @param bar  the bar shape.
* @param xOffset  the x-offset for the shadow.
* @param yOffset  the y-offset for the shadow.
* @param base  the edge that is the base of the bar.
* @return A rectangle for the shadow.
*/
double x0=bar.getMinX();
double x1=bar.getMaxX();
double y0=bar.getMinY();
double y1=bar.getMaxY();
if (base == RectangleEdge.TOP) {
x0+=xOffset;
x1+=xOffset;
y0+=yOffset;
}
y1+=yOffset;
}
else   if (base == RectangleEdge.BOTTOM) {
x0+=xOffset;
x1+=xOffset;
y0+=yOffset;
y1+=yOffset;
}
}
else   if (base == RectangleEdge.LEFT) {
x0+=xOffset;
}
x1+=xOffset;
y0+=yOffset;
y1+=yOffset;
}
else   if (base == RectangleEdge.RIGHT) {
x0+=xOffset;