Turns out overriding getTooltipLocation() is really easy - my main concern was that if I overrode that method with a fixed location, I'd lose Swing's fancy calculations that prevent the tooltip from being cut off by the edge of the screen. Turns out that was unfounded - it still does that. So my overridden method is a single line - not bad at all.
sorry - nothing to see - back to NB business :-) tom On Mon, Jan 29, 2018 at 2:45 PM, Thomas Wolf <[email protected]> wrote: > I just came across a curious problem that I can't believe has not been > addressed in the decades that Swing has now been around (and I've been > using it :-( It has to do with Tooltips: > > Suppose you have a widget - e.g. a JButton - in the bottom right of your > window. This widget displays some useful information when the user hovers > over it. When the window is maximized, it is observed that the Tooltip > itself is showing on top of the widget - since there's no room for the text > in its usual place, beneath. Alas, Swing's placement of the tooltip now > makes it impossible to click on the widget (a 16x16 Button). > > The only solution I could think of is to override the > "getToolTipLocation()" method for the widget and try to do my own > calculation there. But it just seems stupid - why isn't Swing taking care > of this? Maybe there's a tooltip property that can be set - e.g. > "SHOW_ABOVE" instead of the default "SHOW_BELOW" would be sufficient for my > need? > > Nobody around here knows Swing (dying technology and all that), so I > figure I'd ask you guys - even if it's got very little (well, nothing, > actually) to do with Netbeans use :-) > > Thnx, > tom > > -- > [email protected] > http://landofwolf.blogspot.com/ > -- [email protected] http://landofwolf.blogspot.com/
