(Sun bug # 6494360)
Steps to Reproduce:
1.
Use a real Tablet PC running Windows XP Tablet PC Edition 2005.
2. Run the applet on this page using Firefox or Internet Explorer running the
Sun JVM.
3. Open the Sun Java Console.
3. Click the checkbox using the tablet's pen.
Actual Results: Single clicks typically result in two item events (sometimes just one).
Expected Results: Single clicks should produce only one item event.
Additional information:
1. The problem has been tested on JREs as old as 1.5.0.09 and as
recent as 1.7 build 02, and occurs in all those versions.
2. The problem does not occur in the Microsoft JVM.
3. The problem does not occur when using a mouse on a Tablet PC. Using the
Microsoft Spy++ tool, clicking a checkbox with either a mouse or a pen produces
only one WM_LBUTTONDOWN message and one WM_LBUTTONUP message. Yet, on the same
trials, the pen produced two Java ItemEvents and the mouse produced only one.
4. The problem does not occur with other Java AWT components (Button, List
and Choice).
5. The problem does not occur with a Wacom drawing tablet connected to a
non-Tablet computer running regular Windows XP.
6. The problem does not occur with a Wacom drawing tablet connected to a
Macintosh OS 10.4 computer running Safari with Apple's version of JRE 1.6.0-b88.
7. The hardware used was a Motion Computing LS800. The problem was also
confirmed on a Motion Computing M1300.
8. This problem is particularly troublesome because programmers on non-pen-based
computers will not know it is an issue, and a second click on a Checkbox often
reverses the effect of the first click.
Notes: If you have any insights, workarounds or comments about
this test page please contact Mickey
Segal. A listing of many Java resources is at this link.
Update: Sun has determined that the problem is due to a thread race condition and circumstances can be found in which the bug produces problems on non-Tablet PCs. For more details see the Sun's page about this bug.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class just_checkbox extends Applet implements ItemListener {
Checkbox checkbox;
int counter;
public void init()
{
checkbox = new Checkbox("Checkbox");
checkbox.addItemListener(this);
add(checkbox);
}
public void itemStateChanged(ItemEvent ie)
{
if (ie.getSource() == checkbox) System.out.println("Item
event " + ++counter);
}
} // END OF Class just_checkbox