Font oldFont = gc.getFont();
gc.setFont(new Font(oldFont.getName(), params.centerTextHeight, oldFont.getStyle()));
Point textExtent = gc.textExtent(params.centerText);
Font oldFont = gc.getFont();
gc.setFont(new Font(oldFont.getName(), params.centerTextHeight, oldFont.getStyle()));
Point textExtent = gc.textExtent(params.centerText);
if (textColor != null)
gc.setForeground(textColor);
gc.drawText(params.centerText, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true);
if (textColor != null)
gc.setForeground(textColor);
gc.drawText(params.centerText, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true);