• Post Reply Bookmark Topic Watch Topic
  • New Topic

Knowing when JTextArea finishes displaying large Document  RSS feed

John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to know when to replace the wait cursor with a normal cursor after doing setDocument() on JTextArea with a large document, I'm looking for a way to tell when JTextArea has presented the document to the user.
My first approach was to do put the code to restore the cursor inside an invokeLater() call after I setDocument(), but I'm not sure this will be dependable. Does anyone know of a way to do that that can be expected to work reliably, or of a different approach to the problem? I'm kind of new to GUI work, and may be missing something obvious.
The program does give the user a way of zeroing in on various interesting parts of the document without working with the whole document in the JTextArea, but the GUI will feel more consistant if the user is allowed select a long section for display in the text area.
The alternative I have, and which I'm beginning to like, is to have the JTextArea display an informative loading message. The loading message stays up after I do the setDocument(), only to be replaced by the large document when it is ready. Is this a standard technique?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!