private void updateEllipsis() {
    if (titlePath == null || getGraphics() == null) {
      return;
    }
    final FontMetrics fm = getGraphics().getFontMetrics();
    int maxLen = titlePath.length();
    final Insets in = getInsets();
    // Calculate default title with that also takes 100px window
    // decorations and border widths into account
    final int defTitleW =
        in.right - in.left + 100 + fm.stringWidth(" - " + Constants.DEFAULT_WINDOW_TITLE);
    String newValue = titlePath;
    while (maxLen >= 12 && fm.stringWidth(newValue) > getWidth() - defTitleW) {
      newValue = FileUtils.getPathEllipsis(titlePath, maxLen);
      maxLen--;
    }
    setTitle(newValue);
  }
This class represents the BinDiff main window.
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/window/MainWindow.java