@Override
  protected void paintComponent(final Graphics gx) {
    super.paintComponent(gx);

    bufferedGraphics.setRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    updateVisibleLinesAndColumns();
    updateCharacterBufferFromModel();

    currentFirstRow = verticalScrollbar.getValue();
    currentFirstCharColumn = horizontalScrollbar.getValue();
    charBuffer.paintBuffer(bufferedGraphics, 0, 0, currentFirstCharColumn);
    gx.drawImage(bufferedImage, 2, 2, this);

    caret.draw(gx, 2 + (caretX * fontCharWidth), 6 + (caretY * fontLineHeight), fontLineHeight - 1);
  }
Updates/rewrites the internal representation of the character buffer (that will be drawn) from
the data model. Updating the character buffer from the data model requires a bit of care: The
model provides a sequence of rows, each divided into a fixed number of columns, and each cell
(identified by a row/column combination) can have multiple lines of text. To properly copy this
into a FormattedCharacterBuffer, the code iterates over all rows first. For each row, it
determines what the maximum number of text lines is (over all columns) - this is needed to
determine the overall height of the row. The individual cells are then filled into the right
row, and everything advances to the next row.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/CodeDisplay/CodeDisplay.java