<Swing Dev> [9] Review request for JDK-7170310: ScrollBar doesn't become active when tabs are created more than frame size

Alexey Ivanov alexey.ivanov at oracle.com
Thu Oct 9 12:07:40 UTC 2014


Hello Swing team,

A small update to the test: I explicitly set look-and-feel to 
MetalLookAndFeel.

Updated webrev: http://cr.openjdk.java.net/~aivanov/7170310/jdk9/webrev.1/

Thanks,
Alexey.

On 08.10.2014 15:57, Alexey Ivanov wrote:
> Hello Swing team,
>
> Could you please review the fix for the bug:
>     bug: https://bugs.openjdk.java.net/browse/JDK-7170310
>     webrev: http://cr.openjdk.java.net/~aivanov/7170310/jdk9/webrev.0/
>
> Description:
> If you add more tabs to JTabbedPane than a frame can fit, scrolling 
> buttons are not enabled, and users have no way to switch to hidden 
> tabs until they click another tab.
>
> The test scenario is to add a new tab and select it right away.
>
> Root cause:
> Scrolling is not handled properly in this case because 
> JTabbedPane.addTab invalidated the component. Method setSelectedIndex 
> scrolls the active tab into view but the location of the new added tab 
> is not available yet.
>
> The fix:
> Invalidate the view of JViewport to ensure its size is set to its 
> preferred size during validation. Then stateChanged listener ensures 
> the layout is valid before scrolling the tabs view.
>
> I created a new automatic test for this issue.
> I ran all JTabbedPane regression tests and they passed.
>
> Thank you in advance,
> Alexey.




More information about the swing-dev mailing list