public void draw(Graphics2D graphics) {
        if (xOffset == -1) {
            xOffset = (int) (rect.width - font.getStringBounds(label, graphics.getFontRenderContext()).getWidth()) / 2;
            yOffset = (int) (font.getLineMetrics(label, graphics.getFontRenderContext()).getAscent() + rect.height) / 2;
        }

        if (isPressed())
            graphics.setColor(Color.RED);
        else if (isHover())
            graphics.setColor(Color.GREEN);
        else
            graphics.setColor(Color.WHITE);
        graphics.fill(rect);
        graphics.setColor(Color.GRAY);
        graphics.setFont(font);
        graphics.drawString(label, rect.x + xOffset, rect.y + yOffset);
    }