// determine the end points
double lX = center_x + (lLineValue * Math.sin(lRotation));
double lY = center_y + (lLineValue * Math.cos(lRotation));
// draw the line
Line2D lLine = new Line2D.Double(center_x, center_y, lX, lY);
g.setColor(Color.black);
g.draw(lLine);
// add to polygone
if (lCol == 0) filledPolygon.moveTo((float)lX, (float)lY);
else filledPolygon.lineTo((float)lX, (float)lY);
}
// draw the polygone
filledPolygon.closePath();
g.setPaint( rcm.getColor(lRow) );
g.draw(filledPolygon);
}
double lRotation;
double lX;
double lY;
TextLayout lLabel;
// draw the lines
for (int lCol = 0; lCol < lNumberOfColumns; lCol++)
{
// determine rotation: there are 2PI/noOfCols vertexes, this is vertex no lCol
// -1 : we want to rotate clockwise
// + PI: rotate 180 degree to get the first column pointing up
// Math.PI ... - Math.PI
lRotation = (-1 * (2 * Math.PI / lNumberOfColumns) * lCol) + Math.PI;
// determine the end points
lX = center_x + (lRadius * Math.sin(lRotation));
lY = center_y + (lRadius * Math.cos(lRotation));
// draw the line
Line2D lLine = new Line2D.Double(center_x, center_y, lX, lY );
g.setColor(Color.black);
g.draw(lLine);
// draw the label
lLabel = new TextLayout("" + model.getColumnValueAt(lCol), new Font("Courier", Font.BOLD, 9), new FontRenderContext(null, true, false));