How to display a temporary baloon tooltip during input validation?

simpatico picture simpatico · Aug 21, 2011 · Viewed 11.7k times · Source

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.

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

Answer

simpatico picture simpatico · Aug 31, 2011

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);