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 / General / April 2006

Tip: Looking for answers? Try searching our database.

ToolTip for Graphical Items

Thread view: 
bwilde@gmail.com - 21 Apr 2006 18:41 GMT
Hello,

I'm trying to make a tool tip pop up whenever the user does a
mouse-over on a filled rectangle that I've drawn on the screen.  I have
no trouble creating the rectangle

Rectangle test = new Rectangle();

And it seems like there should be something like
test.setToolTipText("rectangle"), but as far as I can tell, there's
nothing like that.  Is there some way to do this?

Thanks,
Ben
Oliver Wong - 21 Apr 2006 20:25 GMT
> Hello,
>
[quoted text clipped - 7 lines]
> test.setToolTipText("rectangle"), but as far as I can tell, there's
> nothing like that.  Is there some way to do this?

   See
http://java.sun.com/docs/books/tutorial/uiswing/components/tooltip.html

There's a part that says:

<quote>
Multi-part components such as JTabbedPane, JTable, and JTree  override [the
String getToolTipText(MouseEvent)] method to return a string associated with
the mouse event location. For example, each tab in a tabbed pane can have
different tool-tip text.
</quote>

   - Oliver
Steve W. Jackson - 21 Apr 2006 21:02 GMT
> > Hello,
> >
[quoted text clipped - 21 lines]
>
>     - Oliver

A Rectangle is nothing more than a class built around the x and y
coordinate of its upper left corner, and its width and height.  It's
just a mathematical representation.  A tooltip is displayed in response
to something happening between a mouse and a Swing component, such as a
JPanel or those listed above or others.  So in order for a Rectangle to
have a tooltip, a graphical representation of it needs to appear on some
component and a tooltip needs to be assigned to that component (or the
appropriate area of it).

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama



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



©2009 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.