使用SWING编程触摸屏应用程序 [英] Programming a touch screen application with SWING

查看:373
本文介绍了使用SWING编程触摸屏应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我的应用程序的UI中的按钮应该听什么事件?要点击鼠标?那么紧迫和释放事件呢?



谢谢,
Tomer

解决方案大多数触摸屏只是模仿一个鼠标,所以如果你的需要很简单,你不需要做任何特别的事情 - JButtons仍然会启动ActionEvents,组合框仍然在启动ItemEvents等。如果你想做任何事情(多点触控,轻弹滚动等),那么您可以使用常规鼠标事件(mouseClicked,mousePressed,mouseDragged等)并提供自己的手势逻辑,或者查看在这个类似的问题


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

解决方案

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.

这篇关于使用SWING编程触摸屏应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆