user671805
user671805

Reputation: 602

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 anybody help me?

Upvotes: 0

Views: 1199

Answers (1)

camickr
camickr

Reputation: 324128

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.

Upvotes: 1

Related Questions