<Swing Dev> [13] RFR JDK-8213535:Windows HiDPI html lightweight tooltips are truncated

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Apr 20 18:14:20 UTC 2020


On 20-Apr-20 10:20 PM, Prasanta Sadhukhan wrote:
>
> On 20-Apr-20 10:16 PM, Sergey Bylokhov wrote:
>> On 4/20/20 8:34 am, Prasanta Sadhukhan wrote:
>>>
>>> On 20-Apr-20 8:54 PM, Sergey Bylokhov wrote:
>>>> On 4/20/20 2:40 am, Prasanta Sadhukhan wrote:
>>>>> http://cr.openjdk.java.net/~psadhukhan/8213535/webrev.4/
>>>>>
>>>>> used the right GC for the tip but we still need the preferredSize 
>>>>> in the paint()
>>>>
>>>> Why do we need it? Do we calculate the size in the 
>>>> ToolTipManager.showTipWindow() incorrectly?
>>>> We call tip.getPreferredSize() there,  does it return different 
>>>> result than in the paint() method?
>>>>
>>> No, there it returns the same value as paint() now after GC fix, but 
>>> c.getSize() in paint() returns the JPanel size which is not same as 
>>> preferredSize and it is not enough to contain the text, it seems.
>>
>> But the panel and window both are created by our code in 
>> ToolTipManager.showTipWindow, should we adjust it?
>>
> But getPreferredSize() uses span calculation+6 which is not present in 
> panel's setSize calculation. I would think using preferredSize is 
> better than meddling with setSize calculation, given that 
> TooltipManager.showTipWindow () also used getPreferredSize() to 
> calculate the tip bounds.

It seems JPanel (component created for LW popup) GC is again null and 
not in sync with JToolTip's GC so in addition to fix JToolTip's GC, we 
also need to set GC of JPanel (jn sync with "contents" or tip's GC), so 
setSize() will be set same as preferredSize.

http://cr.openjdk.java.net/~psadhukhan/8213535/webrev.5/

Regards
Prasanta


More information about the swing-dev mailing list