Tablet Java

Java's default behavior is to discard multiple mouse drag events when they come one right behind another, which makes sense for a mouse-based system but is a serious problem for a pen-based tablet PC. With a mouse, all you're ever interested in is the ultimate destination where the user drags a window or icon. Thus, the system can improve performance by discarding all the information about the path the mouse moved over, keeping only the endpoint. On a tablet computer, where the user is often drawing on the screen with a pen, discarding drag events effectively throws away the path the user drew. If the program doesn't respond quick enough (and it's impossible to guarantee that it will), the result is a straight line between two points where in fact the user drew a more complex curve.

I deal with this problem by running a modified Java runtime on my Linux tablet that doesn't coalease multiple mouse drag events. Two places in the source need to be patched, which results in a modified graphics.jar, part of the Java runtime. You then replace the stock graphics.jar with the modified one.

This is for the IBM SDK, Java(tm) 2 Technology Edition, v1.4.2.

If you have a different version of Java, I suggest trying the source patch below, since the .class and .jar files almost certainly won't work for you.

To use this, you need one of the following things: (ordered by increasing size, and decreasing complexity of use)

If you download the patch, you need the Java source code from the IBM release (the 12 MB src.jar). After patching the Java source, you need to recompile the modified files (ignore the warning):

baccala@vm ~/IBMJava2-142/src/java/awt$ javac EventQueue.java Component.java
Note: Component.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
baccala@vm ~/IBMJava2-142/src/java/awt$

Notice that you don't have to re-compile the entire Java runtime (nice).

Now you've got the compiled class files - you only need Component.class and EventQueue.class - which you could also have downloaded above. Now, make sure they're in a sub-sub-directory called java/awt (perhaps because you compiled them there), and from the parent directory (where you've got a copy of graphics.jar from the lib directory of the Java runtime distribution), run:

$ jar uf graphics.jar java/awt/EventQueue.class java/awt/Component.class

Alternately, (if you don't have jar) you could use zip:

$ zip -r graphics.jar java/awt/EventQueue.class java/awt/Component.class

This replaces the class files in graphics.jar and creates a modified graphics.jar (which you also could have downloaded above). Now you should backup your old graphics.jar and replace it with the new one.

Finally, you can now use a Java application like Jarnal without your tablet PC dropping any strokes.

Brent Baccala
baccala@freesoft.org
2 Jan 2005