2005-09-23 Lillian Angel <[EMAIL PROTECTED]> Fixes Bug #23529 * javax/swing/plaf/basic/BasicScrollBarUI.java (mousepressed): Made delay shorted while pressing the arrow button. This makes the scrollbar move more smoothly. (mouseReleased): Reset the delay to the default, so single clicks only move the scrollbar 1 unit. Also, when the mouse is released, the scrollbar should move 1 unit. (shouldScroll): Should not be able to scroll by block when the mouse is in the thumbRect. (mousePressed): Made delay shorted while pressing in the scroll area. This makes the scrollbar move more smoothly. (mouseReleased): Should move the scrollbar 1 block when the mouse is released. Also, reset the timer to default delay.
Index: javax/swing/plaf/basic/BasicScrollBarUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v retrieving revision 1.24 diff -u -r1.24 BasicScrollBarUI.java --- javax/swing/plaf/basic/BasicScrollBarUI.java 6 Sep 2005 15:06:40 -0000 1.24 +++ javax/swing/plaf/basic/BasicScrollBarUI.java 23 Sep 2005 14:57:02 -0000 @@ -80,6 +80,7 @@ */ protected class ArrowButtonListener extends MouseAdapter { + /** * Move the thumb in the direction specified by the button's arrow. If * this button is held down, then it should keep moving the thumb. @@ -91,9 +92,10 @@ scrollTimer.stop(); scrollListener.setScrollByBlock(false); if (e.getSource() == incrButton) - scrollListener.setDirection(POSITIVE_SCROLL); - else - scrollListener.setDirection(NEGATIVE_SCROLL); + scrollListener.setDirection(POSITIVE_SCROLL); + else if (e.getSource() == decrButton) + scrollListener.setDirection(NEGATIVE_SCROLL); + scrollTimer.setDelay(100); scrollTimer.start(); } @@ -105,6 +107,11 @@ public void mouseReleased(MouseEvent e) { scrollTimer.stop(); + scrollTimer.setDelay(300); + if (e.getSource() == incrButton) + scrollByUnit(POSITIVE_SCROLL); + else if (e.getSource() == decrButton) + scrollByUnit(NEGATIVE_SCROLL); } } @@ -316,9 +323,6 @@ else value = valueForYPosition(currentMouseY); - if (value == scrollbar.getValue()) - return; - if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); @@ -333,6 +337,7 @@ trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } + scrollTimer.setDelay(100); scrollTimer.start(); } else @@ -357,11 +364,24 @@ */ public void mouseReleased(MouseEvent e) { - trackHighlight = NO_HIGHLIGHT; scrollTimer.stop(); - - if (scrollbar.getValueIsAdjusting()) - scrollbar.setValueIsAdjusting(false); + scrollTimer.setDelay(300); + currentMouseX = e.getX(); + currentMouseY = e.getY(); + + int value; + if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) + value = valueForXPosition(currentMouseX); + else + value = valueForYPosition(currentMouseY); + if (shouldScroll(POSITIVE_SCROLL)) + scrollByBlock(POSITIVE_SCROLL); + else if (shouldScroll(NEGATIVE_SCROLL)) + scrollByBlock(NEGATIVE_SCROLL); + + trackHighlight = NO_HIGHLIGHT; + scrollListener.setScrollByBlock(false); + scrollbar.setValueIsAdjusting(true); scrollbar.repaint(); } @@ -381,6 +401,9 @@ else value = valueForYPosition(currentMouseY); + if (thumbRect.contains(currentMouseX, currentMouseY)) + return false; + if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else @@ -873,8 +896,7 @@ trackRect = new Rectangle(); thumbRect = new Rectangle(); - scrollTimer = new Timer(50, null); - scrollTimer.setRepeats(true); + scrollTimer = new Timer(300, null); installComponents(); installDefaults();
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches