> I have the follwoing problem. I'm ploting a point into a graphics
> object using graphics.fillOval function. When the user point the mouse
> in this point, I'd like to show a box (something like a JTipTool) with
> a message but I'm not able to do that. Does someone have any clue on
> how to do that?

Signature
Andrey Kuznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
> JTipTool???
> JToolTip!!!
Sorry, you're wright
> see JComponent.getToolTipText(MouseEvent event);
I overwrite the method but i didn't work either. This is my class:
class Point extends JComponent{
private int pointDisplaySize = 5;
private int fp, tp;
public Point(int FP, int TP){
fp = FP;
tp = TP;
this.setLocation(fp,tp);
this.setSize(new Dimension(pointDisplaySize,pointDisplaySize));
this.setPreferredSize(new
Dimension(pointDisplaySize,pointDisplaySize));
}
public void paintComponent(Graphics g )
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
Ellipse2D.Double ellipse = new Ellipse2D.Double(fp, tp,
pointDisplaySize, pointDisplaySize);
g2d.fill(ellipse);
}
public java.lang.String getToolTipText(java.awt.event.MouseEvent
event){
return ("("+tp+","+fp+")");
}
}
I have a vector with several Point objects. For each object, I'm adding a
MouseListener. But it seems that it is not handling the mouse events.
Is that right? I'm new in gui programing and not very familiar in handling
events.
Thanks,
Ronaldo
Andrey Kuznetsov - 07 Feb 2005 18:22 GMT
>> see JComponent.getToolTipText(MouseEvent event);
>
> I overwrite the method but i didn't work either.
ToolTipManager.sharedInstance().registerComponent(JComponent comp);

Signature
Andrey Kuznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities