joosteee
Posts: 3
Joined: Mon Jan 26, 2015 6:49 pm

Java Swing GUI with TFT Touch screen

Sun Aug 09, 2015 11:03 am

Good afternoon,

I've built a home project for my student house, including a 3.2" Touch Screen. The GUI for the program is written in Java, using the Swing framework. My program works perfectly on my Windows machine, however, when I transfer it to my Raspberry Pi, the start screen pops up but my JButtons won't work. I'm using ActionEvents and ActionPerformed to handle the buttons.
I thought that the touch screen would simulate the touch as a mouse click, but now I'm starting to question this. Does anybody know how to fix this? Use different handlers, buttons or something else?

I don't receive any other errors within my program, the screen and GUI just don't respond to the touch inputs whereas it does on the Windows machine. The rest of the Raspbian GUI does work with the touch screen.

I hope you guys have a solution :)

Joost

arisw
Posts: 7
Joined: Tue Aug 11, 2015 5:13 am

Re: Java Swing GUI with TFT Touch screen

Tue Aug 11, 2015 7:19 am

I don't have a solution but I remember some months I was able to do a little demo using JavaFx.
I used a touch-screen of Adafruit.

Can you try a little demo with JavaFx and see if it works ?

User avatar
xranby
Posts: 540
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Java Swing GUI with TFT Touch screen

Thu Aug 13, 2015 2:13 pm

joosteee wrote:Good afternoon,

I've built a home project for my student house, including a 3.2" Touch Screen. The GUI for the program is written in Java, using the Swing framework. My program works perfectly on my Windows machine, however, when I transfer it to my Raspberry Pi, the start screen pops up but my JButtons won't work. I'm using ActionEvents and ActionPerformed to handle the buttons.
I thought that the touch screen would simulate the touch as a mouse click, but now I'm starting to question this. Does anybody know how to fix this? Use different handlers, buttons or something else?

I don't receive any other errors within my program, the screen and GUI just don't respond to the touch inputs whereas it does on the Windows machine. The rest of the Raspbian GUI does work with the touch screen.

I hope you guys have a solution :)

Joost
Please publish your applications sourcecode under public domain of a free software license if you want help to debug why the events are not recived.
Its important that the application can be compiled easily for others to help you test on various touch screens.

Can you send touch events to some other swing application or do the missing events only happen with your application?
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

User avatar
clicky
Posts: 481
Joined: Thu Oct 25, 2012 7:34 am

Re: Java Swing GUI with TFT Touch screen

Thu Aug 27, 2015 7:41 pm

Just as xranby said - if other applications under X windows do receive mouse events - Java will, too. At least in theory it should work fine...

Return to “Java”