<Swing Dev> RfR JDK-8134116, Add more comprehensive fix and regression test for JDK-8133897

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Nov 10 12:12:38 UTC 2015


Hi, Pete.
On 31.10.15 6:28, Pete Brunet wrote:
> http://cr.openjdk.java.net/~ptbrunet/JDK-8134116/webrev.03/

My suggestion was to remove all usage of parent.indexOfTab(title) in the 
code and replace it by parent.indexOfTabComponent(comp).
For example:
     getTabBounds(parent, parent.indexOfTab(getTitle()));
Can return incorrect bounds if a few pages will have the same title.

Another problem in the fix is that it iterates over components twice: in 
the getTitle()->(parent.indexOfComponent(component)), and in the 
parent.indexOfTab(title).

Please do not use such comments in the code "// For 
JDK-8133897/JDK-8134116", this information can be obtained from the 
mercurial history.



>>>      I guess it will be better to don't use the title (especially
>>> parent.indexOfTab(title)) at all in the our code, except the situation
>>> when we should access the title(like in getAccessibleName()). All
>>> other cases should be rewritten to use
>>> parent.indexOfTabComponent(comp). For example your  "private String
>>> getTitle() {}" can be implemented like this:
>>>
>>>     return getTitleAt(parent.indexOfTabComponent(comp));
>>>
>>> On 20.10.15 18:45, Pete Brunet wrote:
>>>> Please review this patch:
>>>> http://cr.openjdk.java.net/~ptbrunet/JDK-8134116/webrev.02/
>>>>
>>>> The issue raised/fixed in 8133897 and now resolved in a better fashion
>>>> in this patch is caused by an override of the functionality of
>>>> JTabbedPane such that its Page inner class title field is not kept up to
>>>> date by the overriding code. When the Page title field is empty
>>>> getTitleAt is now called so that the overridden getTitleAt will provide
>>>> the title.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8134116
>>>>
>>>> Pete
>>>>
>>>
>


-- 
Best regards, Sergey.



More information about the swing-dev mailing list