JavaFX的:激活​​提示一个按钮 [英] Javafx : Activate a tooltip with a button

查看:191
本文介绍了JavaFX的:激活​​提示一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JavaFX的一个小应用程序和要显示在textarea的工具提示,当用户点击一个帮助按钮。

I'm using JavaFx for a little app and a want to display a tooltip on a textArea when the user is clicking on a "help" button.

没有问题的tootltip链接到我的textarea的,但没有办法激活它,当用户点击该按钮。有没有办法做到这一点?

No problem for linking a tootltip to my textArea, but no way to activate it when the user click on the button. Is there a way to do that?

推荐答案

显示按需工具提示的能力需要的工具提示,这是不是在JavaFX的2.2。实施RT-19538定制的知名度时机

The ability to display a Tooltip on demand requires a resolution of RT-19538 Customizable visibility timing for Tooltip, which is not implemented in JavaFX 2.2.

作为一种解决方法,你可以试试下面的任何可能的策略:

As a workaround, you could try any of the possible strategies below:


  1. 显示工具提示您的数据在文本菜单代替的。随着文本菜单,你当它显示了完全控制。

  2. 您可以为您所需的功能,创建一个自定义 PopupControl

  3. 您可以用自定义实现皮肤,让显示工具提示,当你控制替换默认TooltipSkin。

  4. 您可以实现RT-19538并提供补丁的<一个href=\"http://hg.openjdk.java.net/openjfx/8/master/rt/file/tip/javafx-ui-controls/src/javafx/scene/control/Tooltip.java\">Tooltip和<一个href=\"http://hg.openjdk.java.net/openjfx/8/master/rt/file/tip/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TooltipSkin.java\">TooltipSkin到的OpenJFX 项目。

  1. Displaying your Tooltip data in a ContextMenu instead. With a ContextMenu, you have complete control over when it is shown.
  2. You could create a custom PopupControl for your required functionality.
  3. You could replace the default TooltipSkin with a custom implemented skin which allows you to control when the Tooltip is displayed.
  4. You could implement RT-19538 and provide a patch to the Tooltip and TooltipSkin to the openjfx project.

第三方库如的积德的JavaFX的测试版提供特殊类,如装饰公用事业,IntelliHints和的可能的是你的情况是有用的。

3rd party libraries such as Jide's JavaFX Beta Release provide special classes like Decorator utilities, IntelliHints and ShapedPopups which might be useful in your case.

这篇关于JavaFX的:激活​​提示一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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