g.setColor(color);
g.fill3DRect(x, y, width, height, true);
// print the text on the node
Graphics gg = g.create(x, y, width, height);
gg.setColor(Color.BLACK);
MethodKey methodKey = node.getMethodKey();
String text = methodKey.getClassName() + "." + methodKey.getMethodName() + " "
+ pctDecimalFormat.format(node.getPctOfAvgRootDuration());
Rectangle2D stringBounds = metrics.getStringBounds(text, g);
if (stringBounds.getWidth() < width) {
gg.drawString(text, (int) (width / 2 - stringBounds.getWidth() / 2), (int) (stringBounds.getHeight()));
} else {
text = methodKey.getMethodName() + " " + pctDecimalFormat.format(node.getPctOfAvgParentDuration());
stringBounds = metrics.getStringBounds(text, g);
if (stringBounds.getWidth() < width) {
gg.drawString(text, (int) (width / 2 - stringBounds.getWidth() / 2), (int) (stringBounds.getHeight()));
}
}