<Swing Dev> [10] RFR JDK-8178025:HiDPI with non-integer scale factor - SPANs in HTML are rendered overlapping each other
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Fri Oct 20 17:01:19 UTC 2017
I do not see how updateGraphicsData() woud trigger layout/span
calculation. Moreover, it has package-protected access to be called for
JLabel.
Regards
Prasanta
On 10/20/2017 8:09 PM, Alan Snyder wrote:
> updateGraphicsData() is also called when the graphics configuration changes, which is what you want.
>
> Without that, you are stuck with the default graphics configuration, which is all that is available until the window is displayed.
>
> updateUI() seems like the wrong place to trigger the layout related recalculation, as layout calculation is only one of things that updateUI() does.
>
> Alan
>
>
>
>> On Oct 19, 2017, at 10:21 PM, Prasanta Sadhukhan <prasanta.sadhukhan at oracle.com> wrote:
>>
>> updateGraphicsData() is called implicitly when component is added to frame.
>> We need to call JLabel.updateUI() for this, as it will trigger calling BasicHTML.updateRenderer() which will go on to recalculate spans.
>> Ideally, I would guess, we should wait for propertyChange() in BasicLabelUI to be called when graphics configuration is updated
>> but I only see it being called with "ancestor" property name, I am not sure if that is property that would be used to notify if gc is updated or not.
>>
>> Regards
>> Prasanta
>> On 10/19/2017 7:54 PM, Alan Snyder wrote:
>>> Do you mean JLabel.updateGraphicsData()?
>>>
>>> Also, this issue could affect applications as well, if they are computing data based on layout information such as the default preferred size.
>>>
>>> What is the recommended method for an application to respond to a change in the graphics configuration?
>>>
>>> From looking at the code, it appears that addNotify() would be the right place, but I would never guess that just from the documentation.
>>>
>>> Alan
>>>
>>>
>>>
>>>> On Oct 19, 2017, at 3:12 AM, Prasanta Sadhukhan <prasanta.sadhukhan at oracle.com> wrote:
>>>>
>>>>
>>>>
>>>> On 10/19/2017 3:49 AM, Sergey Bylokhov wrote:
>>>>> On 17/10/2017 03:48, Prasanta Sadhukhan wrote:
>>>>>> It seems for JLabel, Component.updateGraphicsData() with proper GraphicsConfiguraiton is never called which it does for JTextComponent or JDialog. Do you know why? Because of this, correct FRC is not created.
>>>>>> I am not sure what else I can do to create correct FRC.
>>>>> But at some point we will get a correct GraphicsConfiguraiton for a component, right? It should be called for the window and child when we show the window on the screen, when we move the window to another screen, etc.
>>>>>
>>>>>
>>>> Yes, it seems to be called when JLabel is added to JFrame but not before.
>>>> Span is calculated in GlyphPainter1.getSpan() which is called when JLabel is created and
>>>> as it seems, not when JLabel is added to JFrame (which is when we get the correct graphics configuration and therefore correct transform).
>>>>
>>>> So, we need to make sure spans are recalculated when the JLabel is added to frame, which is what modified webrev does by calling JLabel.updateUI()
>>>> http://cr.openjdk.java.net/~psadhukhan/8178025/webrev.01/
>>>>
>>>> Regards
>>>> Prasana
>>>>
More information about the swing-dev
mailing list