简体   繁体   English

jPanel显示空的工具提示文本

[英]jPanel shows empty tooltip text

I have a few radio buttons and then a checkbox, I have tooltip's for the radio buttons but not the checkbox. 我有几个单选按钮,然后有一个复选框,我有单选按钮的工具提示,但没有该复选框。 Which works okay, unless I get a radio to display it's tool tip text and then quickly move to the checkbox, before the tip disappears, and now I have my mouse on the checkbox but it is displaying the tooltip for the previously moused over radio button. 可以正常工作,除非我让收音机显示它的工具提示文本,然后在提示消失之前快速移动到复选框,现在我将鼠标放在复选框上,但是它显示了以前被鼠标悬停在单选按钮上的工具提示。

I tried setting a blank ( "" ) tool tip for the checkbox, which works okay except that it displayed a very small tooltip square. 我尝试为该复选框设置一个空白( "" )工具提示,除了显示一个非常小的工具提示方块之外,其他方法都可以正常工作。

Is there anyway to either force the previous tooltip to go away or to properly set a nothing tooltip for the checkbox? 无论如何,要么迫使上一个工具提示消失,要么为复选框正确设置了空工具提示?

    radioButtonsetText("text");
    radioButton.setToolTipText("tooltip text");
    checkBox.setText("text");
    checkBox.setToolTipText("");

or to properly set a nothing tooltip for the checkbox? 或为复选框正确设置“无”工具提示?

Components don't have a tooltip by default. 默认情况下,组件没有工具提示。 So don't set the tooltip and your won't have a problem. 因此,请勿设置工具提示,这样就不会有问题。

If you set the text and want to remove it the try using: 如果您设置了文本并想删除它,请尝试使用:

component.setToolTipText(null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM