On 1/13/2016 1:12 AM, Pete Brunet wrote:
Hi Alexandr,

On 1/12/16 1:03 PM, Alexander Scherbatiy wrote:
It seems that there still is the case when tab titles are empty
string, tab components are null, components are not null and the
correct index should be returned for the given page.
In the code of the current webrev (webrev.00) if the tab component is
null then getTitle() is the fallback and it uses
parent.indexOfComponent().  I tested using add("", myPanel) and that
worked OK.
May be it is better to replace searching the page index by tab
component to by component?
We already do this in the getTitle() method.
In any event, are you suggesting just always using
parent.indexOfComponent(), i.e. always using getTitle()?  The regression
test runs OK with that change.  Is there a case where indexOfComponent
would not work but indexOfTabComponent would?
There is a possible case that a component is null, title is empty but a tabComponent is not null. May be it is better to have a method like getPageIndex() which search the page index by component if it is not null, then by tabComponent and by title at the last.

  Thanks,
  Alexandr.


Pete
Thanks,
Alexandr.

On 12/01/16 01:47, Pete Brunet wrote:
Please review this patch:

http://cr.openjdk.java.net/~ptbrunet/JDK-8145735/webrev.00/

The issue being resolved is that the JTabbedPane code can't solely rely
on tabComponent when fetching the index in the parent component.
tabComponent is optionally used and its presence indicates that the
associated Component will render the tab title; otherwise the
JTabbedPane tab will.  In those cases where tabComponent is used, if it
is null then the tab's title must be used when determining the index in
parent, i.e. parent.indexofTab(getTitle()) vs
parent.indexOfTabComponent(tabComponent).

The regression test was improved to catch the cases where the fix to
JTabbedPane was not applied.  The regression test was also changed so
the exception message is more cleanly displayed when the test fails.

Reply via email to