src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java

Print this page




  43     // when we notice that the shift key is down. This should be removed when AWT/Swing
  44     // becomes aware of of multi-axis scroll wheels.
  45     protected class XYMouseWheelHandler extends javax.swing.plaf.basic.BasicScrollPaneUI.MouseWheelHandler {
  46         public void mouseWheelMoved(final MouseWheelEvent e) {
  47             JScrollBar vScrollBar = null;
  48             boolean wasVisible = false;
  49 
  50             if (e.isShiftDown()) {
  51                 vScrollBar = scrollpane.getVerticalScrollBar();
  52                 if (vScrollBar != null) {
  53                     wasVisible = vScrollBar.isVisible();
  54                     vScrollBar.setVisible(false);
  55                 }
  56             }
  57 
  58             super.mouseWheelMoved(e);
  59 
  60             if (wasVisible) {
  61                 vScrollBar.setVisible(true);
  62             }



  63         }
  64     }
  65 }


  43     // when we notice that the shift key is down. This should be removed when AWT/Swing
  44     // becomes aware of of multi-axis scroll wheels.
  45     protected class XYMouseWheelHandler extends javax.swing.plaf.basic.BasicScrollPaneUI.MouseWheelHandler {
  46         public void mouseWheelMoved(final MouseWheelEvent e) {
  47             JScrollBar vScrollBar = null;
  48             boolean wasVisible = false;
  49 
  50             if (e.isShiftDown()) {
  51                 vScrollBar = scrollpane.getVerticalScrollBar();
  52                 if (vScrollBar != null) {
  53                     wasVisible = vScrollBar.isVisible();
  54                     vScrollBar.setVisible(false);
  55                 }
  56             }
  57 
  58             super.mouseWheelMoved(e);
  59 
  60             if (wasVisible) {
  61                 vScrollBar.setVisible(true);
  62             }
  63             // Consume the event even when the scrollBar is invisible
  64             // see #7124320
  65             e.consume();
  66         }
  67     }
  68 }