开发者

ToolTip flicker in Java if outside JFrame?

I am implementing ToolTip in Java as to make users having an easier time to use the product. Though tooltip that are at the borders of the JFrame and ends up outside the JFrame starts to "flicker". I've tried lots of things (like moving the tooltip so it should be inside the Jframe, controlling the painting so it ends up within the JFrame and so on) though it开发者_运维技巧 doesn't work.

Anyone got any expertise within the field that know how to avoid this problem?

Cheers, Skarion


When a tooltip is displayed in a JFrame, Swing does not create a floating window, it simply paints the tooltip in the graphic context of the JFrame. This does not generate any flickering. On the other hand, when a tooltip is outside the boundaries of the JFrame, it becomes heavyweight: a window is created to host the tooltip component. Flickering occurs when the tooltip window appears.

Maybe setting "-Dsun.awt.noerasebackground=true" would help because it prevents one step of background repainting of the hosting window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜