将鼠标悬停在标签上,如何获得JLabel的文本(带有图标)来解释标签是什么? [英] How would I get the text of a JLabel (with an icon) explaining what the label is by hovering over the label?

查看:64
本文介绍了将鼠标悬停在标签上,如何获得JLabel的文本(带有图标)来解释标签是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将鼠标悬停在标签上时,我想查看JLabel的文本.文字详细说明了标签的作用.

I want to see the text of JLabel when I hover over the label. The text explains what the label does in detail.

推荐答案

您需要调用以下命令来设置工具提示的文本:setToolTipText()

You would need to set the text of the tooltip by calling: setToolTipText()

有关教程中工具提示的更多信息: http://download.oracle .com/javase/tutorial/uiswing/components/tooltip.html

More about tooltips in the tutorial: http://download.oracle.com/javase/tutorial/uiswing/components/tooltip.html

这篇关于将鼠标悬停在标签上,如何获得JLabel的文本(带有图标)来解释标签是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆