-
Bug
-
Resolution: Fixed
-
P1
-
1.0, 1.1, 1.1.1
-
1.1.5
-
generic, x86, sparc
-
solaris_2.5, solaris_2.5.1, windows_95
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2015028 | 1.2.0 | Mike Bronson | P1 | Resolved | Fixed | 1.2 |
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
- backported by
-
JDK-2015028 Scrolling won't stop on sparc-S2 AWT
- Resolved
- duplicates
-
JDK-4030623 scrollbar arrows scroll too far on Solaris
- Closed
-
JDK-4035196 Solaris: clicking once on scrollbar arrow sends multiple events
- Closed
-
JDK-4040132 Scrollbar is sending extra events with single mouse clicks when event handler is
- Closed
- relates to
-
JDK-4195694 Scrollbar.set{Value,Values()} fails to generate an AdjustmentEvent
- Closed
-
JDK-4028268 jump scrolling skips parts of a page
- Closed
-
JDK-4082522 awt_MToolkit_loop switches on xev.type, which may contain garbage.
- Closed