<Swing Dev> [13] RFR JDK-8213535:Windows HiDPI html lightweight tooltips are truncated
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Fri Apr 17 11:16:48 UTC 2020
On 15-Apr-20 5:11 PM, Sergey Bylokhov wrote:
> On 4/6/20 5:07 am, Prasanta Sadhukhan wrote:
>>
>> tip = insideComponent.createToolTip();
>> tip.setTipText(toolTipText);
>> +
>> + System.out.println("default gc " +
>> gc.getDefaultTransform());
>> + System.out.println("insideComponent GC " +
>> insideComponent.getGraphicsConfiguration().getDefaultTransform());
>> + GraphicsConfiguration oldConfig =
>> tip.getGraphicsConfiguration();
>> + System.out.println("tip oldgc " +
>> tip.getGraphicsConfiguration());
>> + GraphicsConfiguration newConfig =
>> tip.getGraphicsConfiguration();
>> + if (newConfig == null) {
>> + newConfig =
>> GraphicsEnvironment.getLocalGraphicsEnvironment().
>> + getDefaultScreenDevice().getDefaultConfiguration();
>> + }
>> + System.out.println("newgc " + newConfig);
>> + if (newConfig != null) System.out.println(" transform "
>> + newConfig.getDefaultTransform());
>> + tip.firePropertyChange("graphicsConfiguration",
>> oldConfig, newConfig);
>> +
>> +
>> size = tip.getPreferredSize();
>> + System.out.println("tip preferredsize " + size);
>
> I think it is necessary to inject the "insideComponent"'s GC to the
> tip somewhere in the .createToolTip() and use this GC by default in
> the tip, for the test we can try to override
> getGraphicsConfiguration() in tip and return
> component.getGraphicsConfiguration().
>
> BTW did you notice that in the test when the size of the frame are
> changed from bigger to smaller by the "space" key the tooltip usually
> cut as well? Probably we need to change the type of the tip on the
> fly? from LW to HW?
Thanks for the suggestion. This approach of setting HW popup is more
cleaner than 1st as there is no public setGraphicsConfiguration() to be
used to set tip's GC with inideComponent's GC.
Also, the popupType will remain LW as we are only using it to create the
tip but doing setPopupType() to LW after tooltip popup creation.
http://cr.openjdk.java.net/~psadhukhan/8213535/webrev.3/
Regards
Prasanta
More information about the swing-dev
mailing list