JDK-7170310 : ScrollBar doesn't become active when tabs are created more than frame size
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2012-05-21
  • Updated: 2015-06-04
  • Resolved: 2014-10-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b38Fixed
Description
When a program create more tabs than the frame can show, scroll bar must be active so that 
user can do something to the newly cretaed and hidden tabs, but actually, the scroll bar 
does not become active.

CONFIGURATION : 
JDK :JDK8b34/7u4/6u32(32bits)
OS : WindowsXP(SP3, Japanese, 32bits)

REPRODUCTION:
(1) Compile the attached test cases(TabTesrFrame.java, TabAddListener.java)
(2) Invoke "java TabTestFrame"
(3) Click "Add Tab" button twice in order to show "Added Tab2" and "Added Tab3.
    "Added Tab3" is hidden partially.
(4) Click "Added Tab2" and then click "Added Tab3".
    "Added Tab3" fully appears.
(5) Click "Add Tab" button.

EXPECTED:
 At the above step (5), scroll bar for right direction becomes active.

ACTUAL:
 The scroll bar for right direction does not become active.

FREQUENCY:
 This problme always occurs.

Comments
The fix: Invalidate the view of JViewport where tabs are painted to ensure its size is set to its preferred size during validation. This ensures all tabs fit. Before trying to scroll the selected tab into visible area, the component ensures it has a valid layout. See code review: http://mail.openjdk.java.net/pipermail/swing-dev/2014-October/003971.html
08-10-2014

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 newly added tab is not available yet. The expected behavior: The newly added tab must be scrolled into view. As it's the last tab, scroll-left button must be enabled and scroll-right button must be disabled.
08-10-2014

EVALUATION I am reassigning the issue on the Swing team for initial evaluation. The test case is written using Swing.
21-05-2012

WORK AROUND To create frame in more wider size ex. setSize(new Dimension(300,300));
21-05-2012