RFR: 8259687: JTabbedPane.setComponentAt doesn't hide previously visible tab component
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jul 29 11:40:35 UTC 2022
On Thu, 28 Jul 2022 21:38:56 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
> A simple change listener is used in JTabbedPane to lazily fill with components - this is done by adding the components to JTabbedPane using the `setComponentAt` in the change listener.
>
> Previously, if the change listener was placed before calling `addTab()` , the previous visible component was overlapping with the current visible component. To fix it, the visibility of previous component is set to false before the current component's visibility is set to true in `setComponentAt`.
>
> Following are the before and after fix screenshots-
>
> 
src/java.desktop/share/classes/javax/swing/JTabbedPane.java line 1603:
> 1601: if (this.visComp != null &&
> 1602: !this.visComp.equals(component)) {
> 1603: // previous component visibility is set to false
It seems `isVisible` is checked before changing the visibility..Should we do it here too?
test/jdk/javax/swing/JTabbedPane/TabbedPaneBug.java line 35:
> 33: /*
> 34: * @test
> 35: * @bug 8265586
bugid wrong
-------------
PR: https://git.openjdk.org/jdk/pull/9681
More information about the client-libs-dev
mailing list