【发布时间】:2022-01-21 05:59:04
【问题描述】:
如果我在按钮上使用 .addActionListener,按钮会触发“onRelease”操作。有没有一种简单的方法可以将该行为更改为“onPress”?
我通过覆盖 pointerPressed 方法找到了解决方法。这适用于我想要实现的目标,但这是正确的方法吗?
Button button1 = new Button("LEFT"){
@Override
public void pointerPressed(int x, int y) {
super.pointerPress(x, y);
m.play();
showLeftForm();
}
};
【问题讨论】:
标签: codenameone