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 / August 2005

Tip: Looking for answers? Try searching our database.

Overridden createToolTip not being called.

Thread view: 
anon03@comcast.net - 15 Aug 2005 14:56 GMT
Hello,

 I was hoping someone might provide me with some clues as to what
might be happening. I have a label which acts as a clock and when the
user moves his mouse over it the date will show up in a tool tip. The
label class that shows the clock is extended from JLabel and is an
inner class of a JPanel class that acts as the parent.

 When I put the JPanel in a JFrame for testing the createToolTip
method that the extended JLabel class overrides is called and the tool
tip is shown. However, when I put this JPanel in our application the
method never gets called. Can someone tell me what could be happenning?

 I've searched the web and I cannot find an answer or a hint as to
what it could be. Any help would be greatly appreciated.

Thanks,
Joe
Andrew Thompson - 15 Aug 2005 15:11 GMT
>   When I put the JPanel in a JFrame for testing the createToolTip
> method that the extended JLabel class overrides is called ...

Huhh?  No, don't explain in words, please.

Prepare an SSCCE[1], if you can get it under 100 lines,
post it here.  Preparing an SSCCE might help you spot the
problem in any case.

[1] <http://www.physci.org/codes/sscce.jsp>

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Not a word, could I relate.  The story was quite clear.."  Led Zeppelin
'Kashmir'

anon03@comcast.net - 16 Aug 2005 14:10 GMT
Well, I have a little bit more information. Its seems to be working in
the application but only after the clock label and its parent is moved
to another panel that is on a different monitor. I think it has to do
with the redrawing of the components that is setting something right.
(It is a two monitor application.) I don't know what could be causing
not to show the first time.

However, another problem has arose. The tool tips are showing up on the
wrong monitor. The clock label is on the right monitor but the tool
tips are showing up on the left monitor (the primary, in the
corresponding position). Its like the window/gui manager doesn't know
about the other monitor.
Monique Y. Mudama - 19 Aug 2005 23:39 GMT
> However, another problem has arose. The tool tips are showing up on
> the wrong monitor. The clock label is on the right monitor but the
> tool tips are showing up on the left monitor (the primary, in the
> corresponding position). Its like the window/gui manager doesn't
> know about the other monitor.

I've had that problem (just now, in fact!) using
setLocationRelativeTo().

My workaround was to use setLocation() in conjunction with
getLocationOnScreen(), ie:

Point pTopLeft = getLocationOnScreen();
           
dialogNote.setLocation(pTopLeft.x + this.getWidth()/2,
   pTopLeft.y + this.getHeight()/2);

This seems to work, if what you want is a dialog popping up from a
window on your second monitor to appear in the same area as the
window.

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Thomas Hawtin - 15 Aug 2005 17:01 GMT
>   When I put the JPanel in a JFrame for testing the createToolTip
> method that the extended JLabel class overrides is called and the tool
> tip is shown. However, when I put this JPanel in our application the
> method never gets called. Can someone tell me what could be happenning?

Perhaps a glass pane, or something else interrupting mouse events.
Perhaps not getting registered with the tooltip manager.

I suggest examining the test app in a debugger. Having a look to see how
the tool tip gets created and shown. Then move back to the main app to
see where this fails.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



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.