Kieran France Kieran France is a programmer for IDRSolutions in charge of internal Java testing. In his spare time he enjoys tinkering with gadgets and code.

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.



Our software libraries allow you to

Convert PDF to HTML in Java
Convert PDF Forms to HTML5 in Java
Convert PDF Documents to an image in Java
Work with PDF Documents in Java
Read and Write AVIF, HEIC, WEBP and other image formats
Kieran France Kieran France is a programmer for IDRSolutions in charge of internal Java testing. In his spare time he enjoys tinkering with gadgets and code.