title: Java Swing JScrollPane not scrolling when shift held down and using mouse wheel
body: <p>I have a simple Java Swing program defined below:</p>
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class Test implements Runnable {
  
      public static void main(String[] args) {
          Test main = new Test();
          SwingUtilities.invokeLater(main);
      }
      
      @Override
      public void run() {
  
          // Application window.
          JFrame mainFrame = new JFrame();
  
          // Set up window.
          mainFrame.setPreferredSize(new Dimension(600,700));
          mainFrame.setFocusable(true);
          mainFrame.requestFocus();
  
          JScrollPane scrollPane = new JScrollPane();
          scrollPane.setPreferredSize(new Dimension(600,700));
  
          JPanel scrollPanel = new JPanel();
          scrollPanel.setLayout(new GridLayout(0,1));
  
          // Add buttons.
          for (int i = 0; i &lt; 40; i ++) {
              JButton button = new JButton(&quot;Button &quot; + i);
              button.setPreferredSize(new Dimension(600,100));
              scrollPanel.add(button);
          }
  
          scrollPane.setViewportView(scrollPanel);
          scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  
          JPanel mainPanel = new JPanel();
          mainPanel.add(scrollPane);
  
          // Fill up window.
          mainFrame.getContentPane().setLayout(new BorderLayout());
          mainFrame.getContentPane().add(mainPanel, BorderLayout.CENTER);
          SwingUtilities.updateComponentTreeUI(mainFrame);
  
          mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          mainFrame.pack();
          mainFrame.setVisible(true);
  
      }
  }
  </code></pre>
  <p>The program consists of a simple JScrollPane with multiple buttons inside of it. Only vertical scrolling is enabled. It works fine.</p>
  <p>However, the problem is, when I am holding down the 'shift' key, vertical scrolling does not work when I am using the mouse wheel to scroll. Vertical scrolling only works when I drag the scrollbar or let go of the 'shift' key.</p>
  <p>Usually, in a JScrollPane, when the 'shift' key is held down, and the mouse wheel is used, it scrolls horizontally instead of vertically. However, I have disabled horizontal scrolling.</p>
  <p>How would I go about enabling vertical scrolling using the mouse wheel if the user is holding down 'shift'?</p>