How to create hint or notification as a two seconds text box/cloud


is there in JUCE any method that allows me to simply display some small text box or cloud with hint for user. I mean something like, when user click somewhere, I want to appear for two second some small text box (near the mouse pointer, where it was clicked) with short message.


You could subclass BubbleComponent and either place it on the desktop or just inside your top level component.

When you want to show it use one of the BubbleComponent::setPosition() methods (such as the one that takes a Component* it should point to), make the component visible, and start the timer.
The timer callback would then just have the component set itself to be invisible.

BubbleComponent draws itself as a shape similar to: :left_speech_bubble:

…so if you don’t want that shape you could override its paint() method (since the pure virtual paintContent() isn’t responsible for the bubble) or just use a normal component and handle the positioning yourself.


Great thanks,
but now I think BubbleMessageComponent would be better in my case, isn’t it?

By the way, thanks for help, it’s stupid but I always can’t find things because lack of word resources. I was looking cloud, textCloud, textBox, messageCloud etc… But of course it’s bubble. How could I know? :slight_smile:


Ah true, I forgot about that class! BubbleMessageComponent is a lot quicker to get up and running. Happy to help!