@Override
    public void render(Graphics2D g2d, int width, int height) {
	if(borderWidth > 0) {
	    int c = borderColor;
	    if(!enabled) {
		float[] hsb = Color.RGBtoHSB((borderColor>>16)&0xFF, (borderColor>>8)&0xFF, borderColor&0xFF, null);
		c = Color.HSBtoRGB(hsb[0], hsb[1]/2, Math.min(hsb[2]*1.2F, 1));
	    }
	    g2d.setColor(new Color(c));
	    if(borderRadius == 0) {
		g2d.fillRect(this.x - borderWidth, this.y - borderWidth, this.width + 2*borderWidth, this.height + 2*borderWidth);
	    }else {
		g2d.fillRoundRect(this.x - borderWidth, this.y - borderWidth, this.width + 2*borderWidth, this.height + 2*borderWidth, borderRadius, borderRadius);
	    }
	}
	if (texture != null) {
	    if (drawBackground)
		g2d.drawImage(texture.getImage(), x, y, x + this.width, y
			+ this.height, texture.getX(), texture.getY(),
			texture.getX() + texture.getWidth(), texture.getY()
				+ texture.getHeight(), new Color(bgColor),
			texture);
	    else
		g2d.drawImage(texture.getImage(), x, y, x + this.width, y
			+ this.height, texture.getX(), texture.getY(),
			texture.getX() + texture.getWidth(), texture.getY()
				+ texture.getHeight(), texture);
	} else if (drawBackground) {
	    int c = bgColor;
	    if(!enabled) {
		float[] hsb = Color.RGBtoHSB((bgColor>>16)&0xFF, (bgColor>>8)&0xFF, bgColor&0xFF, null);
		c = Color.HSBtoRGB(hsb[0], hsb[1]/2, Math.min(hsb[2]*1.2F, 1));
	    }
	    g2d.setColor(new Color(c));
	    if(borderRadius == 0)
		g2d.fillRect(x, y, this.width, this.height);
	    else
		g2d.fillRoundRect(this.x, this.y, this.width, this.height, borderRadius - borderWidth, borderRadius - borderWidth);
	}

	g2d.setFont(font);
	String translatedText = translate ? Client.instance.translation.translate(text, textData) : text;
	Rectangle2D bounds = g2d.getFontMetrics().getStringBounds(translatedText, g2d);
	g2d.setColor(new Color(textColor));
	g2d.drawString(translatedText,
		(float) (x + (this.width - bounds.getWidth()) / 2),
		(float) (y + (this.height + bounds.getHeight()) / 2));
    }