private void setScrollBarMaximum() {
    final int totalRows = codeModel.getNumberOfRows();
    int scrollRange = totalRows;

    // Disables the vertical scroll bar if all rows are visible.
    if (scrollRange < 0) {
      scrollRange = 0;
      verticalScrollbar.setValue(0);
      verticalScrollbar.setEnabled(false);
    } else {
      verticalScrollbar.setEnabled(true);
    }

    verticalScrollbar.setMaximum(scrollRange);
    final int totalWidth = codeModel.getTotalWidthInCharacters();
    int realWidth = getWidth();
    realWidth -= verticalScrollbar.getWidth();

    // Disables the horizontal scroll bar if everything fits into the component.
    if (realWidth >= (totalWidth * fontCharWidth)) {
      horizontalScrollbar.setValue(0);
      horizontalScrollbar.setEnabled(false);
    } else {
      horizontalScrollbar.setMaximum(totalWidth + 1);
      horizontalScrollbar.setEnabled(true);
    }
  }
Updates the maximum scroll range of the scroll bar depending on the number
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/CodeDisplay/CodeDisplay.java