Set the Tooltip Delay Time for a Particular Component in Java Swing

前端 未结 4 1178
不思量自难忘°
不思量自难忘° 2020-12-29 21:39

I\'m trying to set tooltips on a JEditorPane. The method which I use to determine what tooltip text to show is fairly CPU intensive - and so I would like to onl

4条回答
  •  Happy的楠姐
    2020-12-29 21:53

    Well, I would recommend doing the CPU intensive task on another thread so it doesn't interrupt normal GUI tasks.

    That would be a better solution. (instead of trying to circumvent the problem)

    *Edit* You could possibly calculate the tootips for every word in the JEditorPane and store them in a Map. Then all you would have to do is access the tootip out of the Map if it changes.

    Ideally people won't be moving the mouse and typing at the same time. So, you can calculate the tootlips when the text changes, and just pull them from the Map on mouseMoved().

提交回复
热议问题