protected void paint(AbstractTnGraphics graphics) {
    NavBottomStatusBarHelper.getInstance().drawBackground(graphics, this, false);

    if (isDisabled) {
      return;
    }

    int width = this.getWidth();
    int height = this.getHeight();

    AbstractTnFont fontNumber =
        UiStyleManager.getInstance().getFont(UiStyleManager.FONT_SPEED_LIMIT_NUMBER);
    AbstractTnFont fontUnit = UiStyleManager.getInstance().getFont(UiStyleManager.FONT_SPEED_LIMIT);

    int gap = (height - fontNumber.getHeight() - fontUnit.getHeight()) / 3;
    int xNumber = (width - fontNumber.stringWidth(speedStr)) / 2;
    int yNumber = (height - fontNumber.getHeight() - fontUnit.getHeight() - gap) / 2;

    int xUnit = (width - fontUnit.stringWidth(unitStr)) / 2;
    int yUnit = yNumber + fontNumber.getHeight() + gap;

    graphics.setColor(UiStyleManager.getInstance().getColor(UiStyleManager.TEXT_COLOR_WH));
    graphics.setFont(fontNumber);
    graphics.drawString(
        speedStr, xNumber, yNumber, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
    graphics.setFont(fontUnit);
    graphics.drawString(unitStr, xUnit, yUnit, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
  }
  protected void paint(AbstractTnGraphics g) {
    // g.setColor(isFocused ? bgFocusedColor : bgUnFocusedColor);
    // g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
    super.paint(g);
    boolean isTitleAvailable = (title != null && title.length() > 0);
    boolean isValueAvailable = (value != null && value.length() > 0);

    int titleY = topGap;

    AbstractTnFont titleFont = getTitleFont();
    if (titleFont == null) {
      titleFont = g.getFont();
    }

    AbstractTnFont valueFont = getValueFont();
    if (valueFont == null) {
      valueFont = g.getFont();
    }

    if (isTitleAvailable) {
      if (isValueAvailable) {
        titleY = topGap;
      } else {
        titleY = (this.getPreferredHeight() - titleFont.getHeight()) / 2;
      }
      g.setColor(isFocused ? titleFocusedColor : this.titleUnFocuedColor);
      g.setFont(titleFont);
      g.drawString(
          title, this.getLeftPadding(), titleY, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
    }

    if (isValueAvailable) {
      int ValueY;
      if (isTitleAvailable) {
        ValueY = titleY + LINE_GAP + titleFont.getHeight();
      } else {
        ValueY = (this.getPreferredHeight() - valueFont.getHeight()) / 2;
      }

      g.setColor(isFocused ? valueFocusedColor : this.valueUnFocusedColor);
      g.setFont(valueFont);
      if (valueFont.stringWidth(value) < this.getPreferredWidth() - 2 * leftPadding) {
        g.drawString(
            value, this.getLeftPadding(), ValueY, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
      } else {
        String tempValue = value;
        while (valueFont.stringWidth(tempValue + "...")
            > this.getPreferredWidth() - 2 * this.getLeftPadding()) {
          tempValue = tempValue.substring(0, tempValue.length() - 1);
        }
        g.drawString(
            tempValue + "...",
            this.getLeftPadding(),
            ValueY,
            AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
      }
    }
  }
  protected void paint(AbstractTnGraphics graphics) {
    super.paint(graphics);
    if (badgeImage != null) {
      int oldBadgeImageWidth = badgeImage.getWidth();
      int oldBadgeImageHeight = badgeImage.getHeight();
      badgeImage.setWidth(badgeWidth);
      badgeImage.setHeight(badgeHeight);

      int left = 0;
      int y = 0;
      if ((this.badgePosition & AbstractTnGraphics.RIGHT) != 0) {
        int rightIconWidht = rightButtonIconFocus == null ? 0 : rightButtonIconFocus.getWidth();
        left =
            this.getWidth() - this.getRightPadding() - rightIconWidht - this.getGap() - badgeWidth;
        y = (this.getHeight() - badgeHeight) / 2;
        if (y < this.getTopPadding()) y = this.getTopPadding();
        graphics.drawImage(badgeImage, left, y, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
      } else if ((this.badgePosition & AbstractTnGraphics.TOP) != 0) {
        // left = this.getWidth() - this.getRightPadding() - badgeImage.getWidth();
        left = this.getWidth() / 2 + this.getFocusedIcon().getWidth() / 4;
        int fontHeight =
            font.getHeight() < boldFont.getHeight() ? boldFont.getHeight() : font.getHeight();
        int iconY =
            topPadding
                + (this.getHeight()
                        - topPadding
                        - bottomPadding
                        - getFocusedIcon().getHeight()
                        - fontHeight
                        - gap)
                    / 2;
        int badageTopHeight = badgeHeight / 3;
        if (iconY < badageTopHeight) {
          y = iconY;
        } else {
          y = iconY - badageTopHeight;
        }
        graphics.drawImage(badgeImage, left, y, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
      } else if (this.badgePosition == this.SAME_Y_AS_ICON) {
        left = this.getFocusedIcon().getWidth() * 5 / 8;
        y = topPadding;
        graphics.drawImage(badgeImage, left, y, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
      }

      left += (badgeWidth - FrogTextHelper.getWidth(this.badge, badgeFont, this.boldFont)) / 2;
      y += (badgeHeight + 1) / 2;
      if (isFocused()) {
        graphics.setColor(badgeFocusedColor);
      } else {
        graphics.setColor(badgeBlurColor);
      }
      if (!"".equalsIgnoreCase(badge.getText())) {
        graphics.setFont(badgeFont);
        graphics.drawString(
            badge.getText(),
            left,
            y,
            AbstractTnGraphics.LEFT | AbstractTnGraphics.FONT_ABSOLUTE_VCENTER);
      }

      badgeImage.setWidth(oldBadgeImageWidth);
      badgeImage.setHeight(oldBadgeImageHeight);
    }
  }