如何在输入验证期间显示临时气球工具提示? [英] How to display a temporary baloon tooltip during input validation?
问题描述
我有点习惯于GUI习惯用法,当我在文本输入字段中键入错误时,会从字段中弹出一个气球,其中包含有关我出错/预期输入的信息。在我再次输入之前它仍然可见。
但现在我找不到任何指向的例子。
I'm somewhat used to the GUI idiom where when I type something wrong in a text input field a balloon pops up from the field with info about what I got wrong / expected input. It remains visible until I type again. But now I couldn't find any example to point to.
给定一个JTextfield你知道任何显示这样气球的库/代码吗?由我的keylistener触发?
Given a JTextfield do you know of any library/code that would display such a balloon when triggered by my keylistener?
@see http: //www.javapractices.com/topic/TopicAction.do?Id=151
推荐答案
Balloon Tip 就是这样做的一个库:
Balloon Tip is a library that does that:
balloonTip = new BalloonTip(f, "Tooltip msg");
这就是全部所需!如果你坚持让它成为工具提示:
That was all needed! If you insist on a having it be a tooltip too:
tooltipBalloon = new BalloonTip(someComponent, "I'm a balloon tooltip!");
// Now convert this balloon tip to a tooltip, such that the tooltip shows up after 500 milliseconds and stays visible for 3000 milliseconds
ToolTipUtils.balloonToToolTip(tooltipBalloon, 500, 3000);
这篇关于如何在输入验证期间显示临时气球工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!