< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java

Print this page

        

@@ -1501,18 +1501,28 @@
 
             int direction = (e.getSource() == incrButton) ? 1 : -1;
 
             scrollByUnit(direction);
             scrollTimer.stop();
+            if (SwingUtilities.windowForComponent((Component)e.getSource())
+                                                                .isFocused()){
             scrollListener.setDirection(direction);
             scrollListener.setScrollByBlock(false);
             scrollTimer.start();
 
             handledEvent = true;
             if (!scrollbar.hasFocus() && scrollbar.isRequestFocusEnabled()) {
                 scrollbar.requestFocus();
             }
+            } else {
+                scrollbar.setValueIsAdjusting(false);
+                ButtonModel model = ((AbstractButton)e.getSource()).getModel();
+                if(model != null){
+                    model.setPressed(false);
+                    model.setRollover(false);
+                }
+            }
         }
 
         public void mouseReleased(MouseEvent e)         {
             scrollTimer.stop();
             handledEvent = false;
< prev index next >