I need to implement a tooltip with a time delay, say, when user point to a widget, the tooltip popup 2 seconds later. i tried the timer but then it shows again and again, i guess that's because the timer fire the tooltip every VISIBLE_DELAY seconds. is there anyway 开发者_开发技巧i can fire it only once? or is there any Class that can sleep for 2 seconds then i can call tooltip.show()? Thanks.
removeDelay = new Timer() {
@Override
public void run() {
ToolTip.this.show();
}
};
removeDelay.schedule(VISIBLE_DELAY);
Call cancel after you show the tooltip.
new Timer() {
@Override
public void run() {
ToolTip.this.show();
cancel();
}
};
精彩评论