JDK-4048060 : Scrolling won't stop on sparc-S2 AWT
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.0,1.1,1.1.1
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS:
    solaris_2.5,solaris_2.5.1,windows_95 solaris_2.5,solaris_2.5.1,windows_95
  • CPU: generic,x86,sparc
  • Submitted: 1997-04-28
  • Updated: 1998-08-13
  • Resolved: 1998-08-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.1.5 1.1.5Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
This is a sparc only bug.

If the application's scrollbar event handler failed to return to AWT, the AWT will keep sending the scrolling events as if the mouse button was held down and caused the scrollbar to run away... (it's on both JDK 1.1 and 1.1.1)

Try the following testing code.

-----------------------------------------------

import java.awt.*;
import java.awt.Color;


public class ScrollbarTest2 extends java.applet.Applet {
        ScrollControl ScrollControl;
        Scrollbar f1;

public void init() {
        Color foreColor = new Color(0,0,0);
        Color backColor = new Color(160,160,160);
        setBackground(backColor);
        setForeground(foreColor);
        setLayout(new GridLayout(1,2,10,10));
	// play with different delay values...
	// if the scrollbar's handler can not return to AWT within certain time,
	// the AWT will keep sending the same event (just as if you press the mouse
	// button down :(
        ScrollControl = new ScrollControl(this, "0",0, /* delay */ 800);
        add(ScrollControl); 
}


void update(ScrollControl in) {
        Color c;
        String s1 = in.lab1.getText();
        int v1 = ScrollControl.f1.getValue();
}

}

class ScrollControl extends Panel {
        Scrollbar f1;
        Label lab1;
        ScrollbarTest2 outerparent;
	int   delay;

        public ScrollControl(ScrollbarTest2 target, String lbl, int val, int delay) {
                this.outerparent = target;
                setLayout(new GridLayout(1,2,0,0));
                f1 = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 200);
                lab1 = new Label(String.valueOf(f1.getValue()),Label.CENTER);
                add(lab1);
                add(f1);
		this.delay = delay;
        }

        public boolean handleEvent(Event evt) {
                if (evt.target instanceof Scrollbar) {
                        int v = ((Scrollbar)evt.target).getValue();
                        lab1.setText(String.valueOf(v)); 
                        this.outerparent.update(this);
			if (evt.id == Event.SCROLL_PAGE_UP || evt.id == Event.SCROLL_PAGE_DOWN) {
			    try {
				Thread.sleep(delay);
			    } catch (Exception e) {
			    }
			}
                        return(true);
                }
                else return false;
        }
}



samuel.chen@Eng 1997-04-28

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.1.5 1.2 FIXED IN: 1.1.5 1.2 INTEGRATED IN: 1.1.5 1.2 VERIFIED IN: 1.1.5
14-06-2004

SUGGESTED FIX Paul Young has a proposal to fix this bug. I think we should integrate his fix. Carol please let me know what you think. jason.li@Eng 1997-07-25 src/solaris/sun/awt_MToolkit.c: Dispatch scrolling events immediately to the ScrollBar widget to prevent spurious continuous scrolling. Otherwise, if the application is busy, the ButtonRelease event is not dispatched in time to prevent a ScrollBar timeout from expiring, and restarting the continuous scrolling timer. src/solaris/sun/awt_MToolkit.c: Use XNextEvent instead of XtAppNextEvent, because XtAppNextEvent processes timers before getting the next X event, causing a race condition, since the TimerEvent callback in the ScrollBar widget restarts the continuous scrolling timer. src/solaris/sun/awt_Scrollbar.c: Remove the ScrollBar widget's continuous scrolling timeout handler on a ButtonRelease to prevent the continuous scrolling that would occur if a timeout expired after the ButtonRelease. This must prevent a bug in Motif. src/solaris/sun/sun/awt/motif/MScrollbarPeer.java: Prevent unnecessary redrawing of the slider, when the slider is already in the correct position. Since the ScrollBar widget now receives the ButtonRelease X event before the Java Adjustor event is handled, the slider is already in the correct position and does not need to be set again and redrawn, when processing the Adjustor event. These files were putback to: JDK 1.1.5: /usr/green/SCCS_DIRECTORIES/JDK1.1-AWT/src/solaris/sun/awt_MToolkit.c /usr/green/SCCS_DIRECTORIES/JDK1.1-AWT/src/solaris/sun/awt_Scrollbar.c /usr/green/SCCS_DIRECTORIES/JDK1.1-AWT/src/solaris/sun/sun/awt/motif/MScrollbarP eer.java JDK 1.2: /usr/green/SCCS_DIRECTORIES/JDK1.2-AWT/src/solaris/native/sun/awt/awt_MToolkit.c /usr/green/SCCS_DIRECTORIES/JDK1.2-AWT/src/solaris/native/sun/awt/awt_Scrollbar. c No change to MScrollbarPeer.java in JDK1.2-AWT mike.bronson@eng 1997-09-26
26-09-1997

EVALUATION Paul Young showed me how to reproduce the bug. jason.li@Eng 1997-07-25
25-07-1997