Java 如何使用tuio调用按钮的侦听器?

Java 如何使用tuio调用按钮的侦听器?,java,multi-touch,Java,Multi Touch,当我使用Tuio做触摸表应用程序时,我对按钮的侦听器有点困惑。 我想我需要像ActionListener()这样的监听器,用于Tuio监听器中的按钮 你们能给我一些想法吗? 多谢各位 在do实现TuioListener之后[当您声明类时]必须将TuioListener添加到Tuio客户端 *client = new TuioClient(); client.addTuioListener(this); client.connect();* 然后,tuio总是在倾听每一次触摸 然后,您必须签入t

当我使用Tuio做触摸表应用程序时,我对按钮的侦听器有点困惑。 我想我需要像ActionListener()这样的监听器,用于Tuio监听器中的按钮

你们能给我一些想法吗?
多谢各位

在do实现TuioListener之后[当您声明类时]必须将TuioListener添加到Tuio客户端

*client = new TuioClient();
client.addTuioListener(this);
client.connect();*
然后,tuio总是在倾听每一次触摸

然后,您必须签入tuioCursor方法(添加、更新、删除)您刚刚接触的组件[通常,当您删除光标时会执行操作]

假设jButton已经分配了它的操作,那么代码相对简单。找到你接触过的点,触摸组件,检查它是否是jButton,将组件转换为jButton,然后它执行它的操作

*public void removeTuioCursor(TuioCursor tc) {

int posX = tc.getScreenX((int) this.getSize().getWidth());
int posY = tc.getScreenY((int) this.getSize().getHeight());

  Component comp = this.getComponentAt(posX, posY);
  if (comp != null) {
     JButton boton = new JButton();
     if (comp.getClass().equals(boton.getClass())) {
        boton = (JButton) comp;
        boton.doClick();
     }
  }
}*