在ToolTipText上使用图标 [英] use of icons on ToolTipText
本文介绍了在ToolTipText上使用图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,当我将鼠标悬停在挥杆组件上时,我需要一个图像/图标来显示
Basically, I need an image/icon to show up whenI hover over a swing component
//this is what i normally use to apply image to components
Icon icon = new ImageIcon(getClass().getResource("icon.png"));
label = new JLabel(icon);
我想做什么:
//use an imported icon on a tool tip text and also add some texts
label.setToolTipText(icon + "some random text");
推荐答案
工具提示支持HTML,因此,该图像的显示方式可能与HTML中的显示方式相同.例如.如此答案所示.
Tool tips support HTML, so display that image as you might display it in HTML. E.G. as seen in this answer.
这篇关于在ToolTipText上使用图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文