Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8134828

Scrollbar thumb disappears with Nimbus L&F

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b94
    • CPU:
      x86_64
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows 7 Enterprise x64
        Version 6.1.7601 Service Pack 1 Build 7601

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Display Adapter: Intel(R) HD Graphics 4600
        Display Driver Version: 9.18.10.3272

        A DESCRIPTION OF THE PROBLEM :
        When using Nimbus L&F, the scrollbar thumb disappears when it becomes too small (i.e. when the ratio of visible height to total height is too low). It is still possible to interact with the invisible scrollbar thumb. Both horizontal and vertical scrollbars exhibit this behavior. Other look-and-feels are not affected.

        REGRESSION. Last worked in version 8u45

        ADDITIONAL REGRESSION INFORMATION:
        I can always reproduce this on my machine. My colleague (using JRE/JDK 8u45) could not reproduce it on his machine. I'm unable to downgrade JRE/JDK on my own machine at this time to verify that this is a regression, but I don't recall seeing this problem before.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Attached sample code contains a JTextArea inside a JScrollPane, presented in a Window form.

        1. Compile and run the attached example
        2. Resize the window to make it smaller, until scrollbar thumbs reach minimum width

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Scrollbar button remains small but visible.
        ACTUAL -
        Scrollbar button disappears. See screen capture of the behavior (GIF): http://i.imgur.com/Hq1ME58.gif

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package nimbusscrollbarpoc;

        public class MainWindow extends javax.swing.JFrame {

            public MainWindow() {
                initComponents();

                // Generate many lines of text
                String line = "0123456789" + System.getProperty("line.separator");
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < 500; i++) {
                    sb.append(line);
                }
                this.textArea.setText(sb.toString());
            }

            @SuppressWarnings("unchecked")
            private void initComponents() {
                scrollPane = new javax.swing.JScrollPane();
                textArea = new javax.swing.JTextArea();

                setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

                textArea.setColumns(20);
                textArea.setRows(5);
                scrollPane.setViewportView(textArea);

                javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                getContentPane().setLayout(layout);
                layout.setHorizontalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
                        .addContainerGap())
                );
                layout.setVerticalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
                        .addContainerGap())
                );

                pack();
            }

            public static void main(String args[]) {
                /* Set the Nimbus look and feel */
                try {
                    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                        if ("Nimbus".equals(info.getName())) {
                            javax.swing.UIManager.setLookAndFeel(info.getClassName());
                            break;
                        }
                    }
                } catch (ClassNotFoundException ex) {
                    java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
                } catch (InstantiationException ex) {
                    java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
                } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                    java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
                }

                /* Create and display the form */
                java.awt.EventQueue.invokeLater(() -> {
                    new MainWindow().setVisible(true);
                });
            }
                          
            private javax.swing.JScrollPane scrollPane;
            private javax.swing.JTextArea textArea;
        }

        ---------- END SOURCE ----------

          Issue Links

            Activity

            Hide
            pardesha Pardeep Sharma added a comment -
            Run the attached test case (MainWindow.java) in Windows 7 (64-bit)

            Checked this for JDK 8u51, 8u60, 9 ea b78
            Result:
            ===========
            8u51: OK
            8u60: FAIL
            9 ea b78: FAIL

            Steps to reproduce:
            ==============
            1. Compile and run the attached program
            2. Resize the window to make it smaller, until scrollbar thumbs reach minimum width
            3. The vertical scrollbar remains visible with 8u51, but with 8u60 and 9 ea b78 it does not appear as expected.

            This is a regression in 8u60 and 9 ea b78 as checked.
            Further, this looks like a duplicate of JDK-8134827
            Show
            pardesha Pardeep Sharma added a comment - Run the attached test case (MainWindow.java) in Windows 7 (64-bit) Checked this for JDK 8u51, 8u60, 9 ea b78 Result: =========== 8u51: OK 8u60: FAIL 9 ea b78: FAIL Steps to reproduce: ============== 1. Compile and run the attached program 2. Resize the window to make it smaller, until scrollbar thumbs reach minimum width 3. The vertical scrollbar remains visible with 8u51, but with 8u60 and 9 ea b78 it does not appear as expected. This is a regression in 8u60 and 9 ea b78 as checked. Further, this looks like a duplicate of JDK-8134827
            Hide
            ssadetsky Semyon Sadetsky added a comment -
            Thumb minimal size is 29 while thumb's painter insets are 15+15. So the thumb image should be shrunk 30->29. But JDK-8041642 fix introduced protection for painter's image shrinking because it causes distortion of the progress bar.
            Since Nimbus thumb image doesn't have light border its shrinking distortion is not noticeable.
            Show
            ssadetsky Semyon Sadetsky added a comment - Thumb minimal size is 29 while thumb's painter insets are 15+15. So the thumb image should be shrunk 30->29. But JDK-8041642 fix introduced protection for painter's image shrinking because it causes distortion of the progress bar. Since Nimbus thumb image doesn't have light border its shrinking distortion is not noticeable.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/b14984244f11
            User: ssadetsky
            Date: 2015-10-29 15:44:40 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/b14984244f11 User: ssadetsky Date: 2015-10-29 15:44:40 +0000
            Hide
            aivanov Alexey Ivanov added a comment -
            Critical Request:
            - Fix for Release : 8u72
            - Justification : Regression from fix to JDK-8041642
            - Risk Analysis : Low, changes in code are not risky
            - Webrev : http://cr.openjdk.java.net/~ssadetsky/8134828/webrev.00/
            - Testing (done/to-be-done) : newly added regression test passes
            - Back ports (done/to-be-done) : backported to 8u76
            - FX Impact : none
            Show
            aivanov Alexey Ivanov added a comment - Critical Request: - Fix for Release : 8u72 - Justification : Regression from fix to JDK-8041642 - Risk Analysis : Low, changes in code are not risky - Webrev : http://cr.openjdk.java.net/~ssadetsky/8134828/webrev.00/ - Testing (done/to-be-done) : newly added regression test passes - Back ports (done/to-be-done) : backported to 8u76 - FX Impact : none
            Hide
            scfitch Stephen Fitch added a comment -
            Post discussion with Alexey. {{

            I'd say it's better included in CPU as well: it's not great to use UI where you can't see scroll bar thumb even though there's enough of space to paint one. Besides the invisible thumb, the scroll bar remains operable.

            The risk is minimal: only Nimbus L&F is affected.
            But this could be used against including it: Nimbus is not so popular.

            }}

            Making the request for the CPU and PSU.

            Critical Request:
            - Fix for Release : 8u71 and 8u72
            - Justification : Regression from fix to JDK-8041642
            - Risk Analysis : Low, changes in code are not risky
            - Webrev : http://cr.openjdk.java.net/~ssadetsky/8134828/webrev.00/
            - Testing (done/to-be-done) : newly added regression test passes
            - Back ports (done/to-be-done) : backported to 8u76
            - FX Impact : none
            Show
            scfitch Stephen Fitch added a comment - Post discussion with Alexey. {{ I'd say it's better included in CPU as well: it's not great to use UI where you can't see scroll bar thumb even though there's enough of space to paint one. Besides the invisible thumb, the scroll bar remains operable. The risk is minimal: only Nimbus L&F is affected. But this could be used against including it: Nimbus is not so popular. }} Making the request for the CPU and PSU. Critical Request: - Fix for Release : 8u71 and 8u72 - Justification : Regression from fix to JDK-8041642 - Risk Analysis : Low, changes in code are not risky - Webrev : http://cr.openjdk.java.net/~ssadetsky/8134828/webrev.00/ - Testing (done/to-be-done) : newly added regression test passes - Back ports (done/to-be-done) : backported to 8u76 - FX Impact : none
            Hide
            afomin Alexander Fomin added a comment -
            The fix is safe, we have several customer's escalations for this issue. SQE OK to take it to CPU16_01.
            Show
            afomin Alexander Fomin added a comment - The fix is safe, we have several customer's escalations for this issue. SQE OK to take it to CPU16_01.
            Hide
            scfitch Stephen Fitch added a comment -
            [ https://en.wikipedia.org/wiki/Scrollbar ] 'Thumb' is the recognized term for the scroll bar element.
            Show
            scfitch Stephen Fitch added a comment - [ https://en.wikipedia.org/wiki/Scrollbar ] 'Thumb' is the recognized term for the scroll bar element.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/b14984244f11
            User: lana
            Date: 2015-11-25 21:18:22 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/b14984244f11 User: lana Date: 2015-11-25 21:18:22 +0000

              People

              • Assignee:
                ssadetsky Semyon Sadetsky
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: