[back to projects]

multi-touch screen

javadoc ->

touchscreen.jar includes source (with javadoc), runs the test applet when double-clicked

it's pretty simple to add touch screen stuff to your code. you must implement the interface TouchScreenApplication, which gives you the callback function touchHappened(Touches touches). create a TouchReceiver, passing it a reference to your app (ie TouchReceiver touchReceiver = new TouchReceiver(this);).

then, every time something happens on the screen, you'll be passed a Touches. this class extends ArrayList, and is a list of Touch-es. a Touch represents a hand on the screen somewhere, and has public ints x and y for the top-left of the hand, w and h for the width and height of the hand, and a status. status can be:
important: after you use the Touches data, be sure to call touchReceiver.update(), which tells the TouchReceiver that you've seen the data, and it is safe to receive more touches. this is done to ensure that you see all JUST_WENT_UP touches.

please help out!
do you have a much better example applet than mine? should the API be changed? suggestions are welcome - this thing was hacked together very quickly. send mail to kevin dot cox, at our university's domain