Kieran France

Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..

Java, Touchscreen and Swing

1 min read

acer-windows-8-laptopMy personal laptop has recently had to be retired. A combination of age, damage to the outer case and over heating problems has made it difficult to use for anything beyond web browsing without it over heating and shutting down. The case is battered to the point of a new chip coming loose every few weeks. The laptop was getting old so it was about time to replace it.

My new laptop has a touchscreen. So I decided to take it to work with me and look into the possibilities of touchscreen with our library and Swing in general. Now I know Swing is on its way out but that doesn’t mean we shouldn’t squeeze as much out of it as possible before then.

So looking at the way the touchscreen works it appears as if the touchscreen is actually just a fancy mouse, when you include multi-touch support it is a very fancy mouse. Now I believe that multi-touch may be a bit out of the reach of Swing. I could be wrong here, a quick search has shown that it might be possible but for now it is beyond my knowledge.

So, single-touch touchscreen functionality is basically a mouse. When using the touchscreen, Swing treats the events of the touch screen as various mouse events. A tap is treated as a mouse pressed action, double tap as a mouse clicked. It is easy enough to guess what the different input methods for the touchscreen translate to.

This is only a very basic review of using touchscreen monitors with Swing. In future posts I will be describing in more detail how to achieve different effects such as using flick to scroll pages based on speed and direction of the flick, gestures and patterns to perform given tasks and anything else I can find of interest.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

Kieran France

Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..

Leave a Reply

Your email address will not be published. Required fields are marked *