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 ----------

          Attachments

            Issue Links

              Activity

                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: