Setting tool tip text for a graphic object
Is there a way to set tool tip text for a drawn line ?
I have looked at stackoverflowques and tried its answer but its not working.
In my program I have also looked at extending to JComponent but am facing the problem that when I set a value of ToolTextTip in paintComponent after drawing the line it is not shown on the screen.
Can anyb开发者_如何转开发ody help me?
You should not use setToolTipText() in the paintComponent() method.
If anything you should be overriding getToolTipText(MouseEvent), to determine when the mouse is over the line and then set the tool tip.
精彩评论