I'm trying to got a tooltip which displays the current progress of a task. So I want that the tooltip text change while the tooltip is displayed. But, when I call setToolTipText()
the displayed text remains the same until I exit the mouse from the tooltip component and enter again. And call setToolTipText(null)
before doesn't change anything.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Indeed it does not update itself, even when resetting the tooltip to null between calls.
So far, the only trick I found was to simulate a mouse-move event and forward it on the TooltipManager. It makes him think that the mouse has moved and that the tooltip must be relocated. Not pretty, but quite efficient.
Have a look at this demo code which displays a progress in % from 0 to 100:
Here's a simplified version of Guillaume Polet's answer which is self-contained in a single method. This code assumes one has called
component.setToolTip("...");
previously. This code does not show how to periodically update the tooltip to show the progress.