Hey guys, I'm trying to figure out how to tell when a JTextComponent is full. I'm trying to set up "pages" so that my users don't have to scroll through their documents, they just "flip" through the pages. Right now I'm allowing the users to change the size of the JEditorpane and it would be kewl if my program could autoresize the pages in response. In particular I'm using a JEditorpane, but I can't seem to tell it to load only enough text to fill up the JEditorpane and nothing more. If anyone could help me, this would be great. Right now I'm digging through Sun's source trying to figure out how the JScrollbar knows when to become enabled and somehow catching this to tell my program to stop loading text into the JEditorpane, but I'm thinking their might be a better way that I don't know about. Thanks in advance, Devin P.S. If no one can help, and I can figure it out, I'll post my solution.
posted 12 years ago
getVisibleRect() will return the visible area of the JEditorpane. You can use FontMetrics to calculate how many characters can fit in that area.