I'd like to be able to print the contents of a CodeArea that contains a hundred or more lines of code, which means I need to break it up into pages for printing. Each line of my code is one Paragraph. Therefore, using PageLayout.getPrintableHeight() to get the total number of points I have to work with on each page, and dividing that total by the number of points of height per paragraph, I can figure out how many paragraphs will fit on a page. But to do this, I need a way of getting the height of a paragraph. Is there a way to do it, given the font and font size of the paragraph, e.g., Courier 12? Or is there some other better way of breaking a CodeArea into pages for printing? (Also, should I have asked this question on StackOverflow instead of here?)
I'd like to be able to print the contents of a CodeArea that contains a hundred or more lines of code, which means I need to break it up into pages for printing. Each line of my code is one Paragraph. Therefore, using PageLayout.getPrintableHeight() to get the total number of points I have to work with on each page, and dividing that total by the number of points of height per paragraph, I can figure out how many paragraphs will fit on a page. But to do this, I need a way of getting the height of a paragraph. Is there a way to do it, given the font and font size of the paragraph, e.g., Courier 12? Or is there some other better way of breaking a CodeArea into pages for printing? (Also, should I have asked this question on StackOverflow instead of here?)