Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

TipTool

Thread view: 
Ronaldo - 07 Feb 2005 12:32 GMT
Hi,

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?

thanks.

Ronaldo
Andrey Kuznetsov - 07 Feb 2005 15:49 GMT
> 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?

JTipTool???
JToolTip!!!

see JComponent.getToolTipText(MouseEvent event);

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

R Prati - 07 Feb 2005 16:29 GMT
> 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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.