JDK-4040132 : Scrollbar is sending extra events with single mouse clicks when event handler is
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-03-19
  • Updated: 1997-11-23
  • Resolved: 1997-11-23
Related Reports
Duplicate :  
Description

Name: sgC58550			Date: 03/19/97


The attached code demonstrates the bug.  When the event handler
for a Motif Scrollbar takes a large amount of time to run, and 
the Scrollbar is sending UNIT_INCREMENT or UNIT_DECREMENT events,
extra events are sometimes generated by the bar.   Thus, single
clicks on the scrollbar arrows will generate multiple scroll
events.  In some cases, a cascade of events will drive the
scrollbar to the end.

In my example, I use a sleep to simulate a large amount of 
processing by the event handler, but I am careful to space out
my mouse clicks so that they do not arrive during a sleep.

The problem occurs when the AWT window is running on the
local machine, and also on a remote X server.

I note that this bug is similar to 4028490, but it does not
involve Win32, does not involve multiple clicks, and single
spurious events can be generated instead of a cascade.


Test case:


import java.awt.*;
import java.awt.event.*;
 
public class MainTest extends Frame {
 
  public MainTest() {
 
    this.addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
          System.exit(0);
        }
      }
    );
 
    class MAL implements AdjustmentListener {
      public void adjustmentValueChanged(AdjustmentEvent e) {
        System.out.println("Scrollbar event " + count++ + " caught");
        Thread myThread = Thread.currentThread();
        try {
          myThread.sleep(400);
        } catch (InterruptedException x ) {
 
        }
        System.out.println("Done sleeping");
      }
    }
 
    Scrollbar myBar = new Scrollbar(Scrollbar.VERTICAL, 0, 6, 0, 80);
    myBar.setBlockIncrement(1);
    myBar.setUnitIncrement(1);
    this.add("East", myBar);
    myBar.addAdjustmentListener(new MAL());
  }
 
  public static void main(String args[]) {
    Frame f = new MainTest();
    f.setSize(500, 500);
    f.show();
  }
 
  private int count = 0;
}


company - Lembersky-Chi Inc. , email - ###@###.###
======================================================================

Comments
WORK AROUND Name: sgC58550 Date: 03/19/97 ======================================================================
11-06-2004

EVALUATION Described the same behavior as in Bug 4035196 and 4048060. xianfa.deng@Eng 1997-11-23
23-11-1997