<Swing Dev> [9] Review request for 8075918: The regression-swing case failed as the long Tab titles are not clipped with dots at the end with the special options"-client -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel"

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Nov 1 19:44:02 UTC 2016


On 28.10.16 12:35, Semyon Sadetsky wrote:
>> Probably this clipping should be done in the
>>  633             paintText(ss, g, tabPlacement, font, metrics,
>>  634                     tabIndex, clippedTitle, textRect, isSelected);
>> ?
> It should be designed in the same way as in basic class. Currently the
> BasicTabbedPaneUI#paintText() receives pre-clipped text to paint and the
> clipping is executed in the paintTab().
>> It seems that currently this method contradicts its specification and
>> skips the w/h of the passed bounds(in this case "textRect").
> I don't see any mentions of text clipping in this spec.

SynthGraphicsUtils.java
      * @param bounds Bounds of the text to be drawn.
      * @param mnemonicIndex Index to draw string at.
      */
     public void paintText(SynthContext ss, Graphics g, String text,
                           Rectangle bounds, int mnemonicIndex) {
....

The textRect variable which is calculated in the changed method and 
passed to paintText() is "Bounds of the text to be drawn". The method 
violates its specification and ignores w/h of these bounds. So the text 
is painted outside of the Tab.

>>
>> On 21.10.16 15:12, Semyon Sadetsky wrote:
>>> Hello,
>>>
>>> Please review fix for JDK9:
>>>
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8075918
>>>
>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8075918/webrev.00/
>>>
>>> Title text clipping capability is added to the Synth L&F's tabbed pane
>>> UI to fix the issue.
>>>
>>
>>
>


-- 
Best regards, Sergey.



More information about the swing-dev mailing list