Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When a dialog is large enough to create scroll bars, and the dialog contains a message widget (String with visibility=MESSAGE), the dialog's view would snap back to scroll the first such message widget into view. It happens when setText is called on the widget's JTextArea, even when the text being set is the same as it was previously. I'm guessing this is a bug in Java somehow. Not sure whether the snap-back is intended to occur when the text changes, but in the case of SciJava message parameters, the text typically never changes, so we can avoid the issue in the vast majority of scenarios by only calling setText when the text *has* actually changed. Unfortunately, a JTextPane in text/html mode is backed by some pretty fancy logic that normalizes the input HTML, such that the final assigned text does not precisely match the input text. For example: Hello becomes something like: <html> <body> Hello </body> </html> and then a naive string comparison fails. To work around this fact, this patch introduces a dummy JTextPane for the sole purpose of filtering the input text, so that it can be compared against the real JTextPane's current text before we attempt to assign it needlessly. Closes #74.
- Loading branch information