Programming a touch screen application with SWING

孤者浪人 提交于 2019-12-06 21:04:12

问题


I would like to know what events my buttons in the UI of my application should have listen to? To mouse click? And what about the pressing and releasing events? Are they the same while clicking via touch screen?

Thanks, Tomer


回答1:


Most touchscreens simply emulate a mouse, so if your needs are simple you don't need to do anything special - JButtons still fire ActionEvents, combo boxes still fire ItemEvents, etc. If you want to do anything fancy (multitouch, flick-scrolling, etc.) then you can use the regular mouse events (mouseClicked, mousePressed, mouseDragged etc.) and provide your own gesture logic, or take a look at the libraries suggested in the answer for this similar question.



来源:https://stackoverflow.com/questions/4707101/programming-a-touch-screen-application-with-swing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!