How do I make a Windows 7 Tooltip in Java

一曲冷凌霜 提交于 2019-12-05 22:48:06
Andrew Thompson

You might need to use a component based on a JWindow for this, as in my answer to Preview window (like Windows 7 taskbar shows for opened applications).

For the rounded corners, see How to Create Translucent and Shaped Windows.

For the slight gradient (squints), paint the BG using a GradientPaint.

A tool-tip provides a functionality not included in that simple example linked. But it is a starting point. Make sure you don't accidentally drop the Windows 7 style tool-tip to pre Windows 7 users or users of other OS'. In the same way you feel the 'square/yellow BG' tool-tip clashes, they will not find the clashing style to be 'pretty'. Which leads to..


The best way to achieve the effect is through a custom PLAF based on The Synth Look and Feel.

Creating a custom look and feel, or modifying an existing one, can be a daunting task. The javax.swing.plaf.synth package can be used to create a custom look and feel with much less effort. You can create a Synth look and feel either programatically or through the use of an external XML file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!