Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 58 forks source link

JTabbedPane Incompatibility with Java7 ? #97

Closed enwired closed 11 years ago

enwired commented 11 years ago

When using Substance version 7.2 (or 7.1) with Java 7 (1.7.0_07-b11) I am frequently getting a stack trace when switching between tabs in a JTabbedPane.

The problem is very similar to what is described here: http://www.java.net/node/700601

In principle, this is a bug in Java itself, but I'd like to know if anyone has been able to find a work-around for it in Substance.

Various bug reports at the Java site either claim this has been fixed, or else is not reproducible. For example: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6923200

    at java.util.TimSort.mergeLo(TimSort.java:747)
    at java.util.TimSort.mergeAt(TimSort.java:483)
    at java.util.TimSort.mergeCollapse(TimSort.java:408)
    at java.util.TimSort.sort(TimSort.java:214)
    at java.util.TimSort.sort(TimSort.java:173)
    at java.util.Arrays.sort(Arrays.java:659)
    at java.util.Collections.sort(Collections.java:217)
    at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136)
    at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110)
    at javax.swing.SortingFocusTraversalPolicy.getComponentAfter(SortingFocusTraversalPolicy.java:280)
    at javax.swing.LayoutFocusTraversalPolicy.getComponentAfter(LayoutFocusTraversalPolicy.java:106)
    at javax.swing.LegacyGlueFocusTraversalPolicy.getComponentAfter(LegacyGlueFocusTraversalPolicy.java:81)
    at java.awt.Component.getNextFocusCandidate(Component.java:7860)
    at java.awt.Component.transferFocus(Component.java:7828)
    at java.awt.Component.hide(Component.java:1684)
    at java.awt.Component.show(Component.java:1653)
    at java.awt.Component.setVisible(Component.java:1603)
    at javax.swing.JComponent.setVisible(JComponent.java:2640)
    at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:389)
    at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
    at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
    at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
    at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
    at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
    at org.pushingpixels.substance.internal.ui.SubstanceTabbedPaneUI$MouseRolloverHandler.mousePressed(SubstanceTabbedPaneUI.java:421)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
kschaefe commented 11 years ago

My company had filed a service request for this. It is an JRE bug and not solvable from Substance. Our testing confirms Oracle's fix in 1.7.0u7. Let me know if this still continues for you, as I'd like to ensure that our users don't see this problem any more.

kschaefe commented 11 years ago

From our BugZilla, this seems to be what forces the issue to occur (gaps that are too small between components):

Well, just to be explicit: this can break anywhere where we have the following layout. Let A, B, and C be three components with the same parent. They have the following properties.

  1. A is above B is above C
  2. The gap between A and B, and between B and C, is less than 10. (ROW_TOLERANCE)
  3. The gap between A and C is at least 10.
  4. C's left edge is to the left of B's, which is to the left of A's.

Pictorially:

|=======A======| (less than 10px gap) |=========B======| (less than 10px gap) |==========C======|

Note that the gap could be as little as zero. One example of where this could occur is any worksheet unit. R1C3, R2C2, and R3C1 would be in this configuration.

enwired commented 11 years ago

Thanks for the info. I realize it is a JRE bug, not a substance bug, but I only see if when I'm running with Substance.

The bug still exists for me in JRE7u7 (1.7.0_07-b11) and JRE7u9 (1.7.0_09-b05).

The specific situation that always causes this for me involves using a JComboBox in a DefaultCellEditor. If the user tries to switch from one tab in a JTabbedPane to another while the JComboBox is open in a JTable, the bug is triggered, but only if I'm using Substance.

For now, this is inside a large application. I may see if I can produce a small test case.

I can, of course, work around the bug by setting "java.util.Arrays.useLegacyMergeSort" to true.

kschaefe commented 11 years ago

I wasn't point on this bug, so I talked with our enigineers. Our SR with Oracle was to get "java.util.Arrays.useLegacyMergeSort" to be a secure JNLP property (so our Webstart apps won't fail).

Apparently, there is no fix for the root cause. Ugh.

shemnon commented 11 years ago

Closing as it is a core java bug.