• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Custom ToolTips not appearing/appearing inconsistently

 
Ranch Hand
Posts: 74
6
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a heads up, this is both a problem and a solution. I upgraded from Java 14 to 17 in my app and I began to see wildly inconsistent functioning of my custom tooltips, with zero functionality whatsoever in Windows. Below is both the problem state and the solution in case anyone runs into the same issues and needs a fix.

BROKEN
In the past, two snippits of code would give you customized tooltips.

Somewhere in startup for your program:


With the class CustomToolTipUI defined like this:


I don't know when this changed, but once I went to J17, things stopped working as they had. ToolTips took 30-45 secoonds to appear at all on macOS/Linux, methods were not firing as expected, and they were 100% kaput on Windows. To correct the problems, update the class you're extending to SynthToolTipUI, and swap out the typical paint() method for an overidden, protected method. I included a line snagging the JComponent from the context simply to show that you can use identical code otherwise. If the traditional paint() method is called, it will automatically drop down to the newly defined one here, so there's no need to override that.

WORKING

 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does extends BasicToolTipUI not work? Does it need the SynthContext stuff?
 
Draque Thompson
Ranch Hand
Posts: 74
6
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not 100% sure why, but the paint method on the base object just does not get called as you would expect. The synth object’s does though. I’m not certain what might have caused the difference in functionality.
 
It runs on an internal combustion engine. This ad does not:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic