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 / December 2003

Tip: Looking for answers? Try searching our database.

How to use JToolTip?

Thread view: 
Rene Ruppert - 27 Nov 2003 17:04 GMT
Hi,

in my component I want to display dynamic tooltips, i.e. a different tooltip
is displayed each time you hover over the component.

I overrode createToolTip() with the following method but the String "TEST"
is never displayed...instead it always shows "HALLO" although the method
createToolTip() is called (I tested with the debugger).

class myComp() extends JComponent
{
 public myComp()
{
 setToolTipText("HALLO!");
}
public JToolTip createToolTip()
{
  JToolTip toolTip = super.createToolTip();
  toolTip.setTipText("TEST...");
  return toolTip;
}
}

Any hints?

Rene
Christian Kaufhold - 27 Nov 2003 17:36 GMT
> in my component I want to display dynamic tooltips, i.e. a different tooltip
> is displayed each time you hover over the component.

Override getToolTipText(MouseEvent)

> I overrode createToolTip() with the following method but the String "TEST"
> is never displayed...instead it always shows "HALLO" although the method
> createToolTip() is called (I tested with the debugger).

The ToolTipManager (naturally) calls setTipText again with the value of
your component's getToolTipText.

Christian
Signature

And in short, I was afraid.

Rene Ruppert - 01 Dec 2003 08:05 GMT
Hallo,

> Override getToolTipText(MouseEvent)
[...]
> The ToolTipManager (naturally) calls setTipText again with the value of
> your component's getToolTipText.

It worked. But what is createToolTip() good for anyway if you don't need to
override it?
When considering the help docs they say that overriding this method is the
correct way to display "your own tooltip".

cu

Rene
Christian Kaufhold - 03 Dec 2003 14:28 GMT
> Hallo,
>
[quoted text clipped - 5 lines]
> It worked. But what is createToolTip() good for anyway if you don't need to
> override it?

I don't think the question make much sense this way.

It is used by the ToolTipManager to create the Tooltip.

> When considering the help docs they say that overriding this method is the
> correct way to display "your own tooltip".

your own tooltip != your own tooltip-text

Christian
Signature

And in short, I was afraid.



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.