char[] charsOnPage = block.getCharactersInBlock();
int charsPerRow = (getSize().width - 2*hgap)/charWidth;
if (charsPerRow <= 0) charsPerRow = 1;
for (int i = 0; i < charsOnPage.length; i++) {
int x = i % charsPerRow;
int y = i / charsPerRow + 1;
g.drawChars(charsOnPage, i, 1, hgap + charWidth*x, vgap + charHeight*y);
}