java - 如何使用鼠标单击事件停止或继续循环?
问题描述
我有一个 java 小程序,它有一个类,它有一个 for 循环。我想要的是当我用鼠标单击事件点击“下一个”按钮时该循环停止,简而言之,我如何停止或继续循环捕获与循环不同类的按钮的 mouseevent ? ,那条件会怎样?你能举个例子吗,因为我的代码还没有完成,我不知道我该怎么做。非常感谢。
PM(boolean opcNotes[], int numtries){
Sonido sonido=new Sonido[opcNotes[].length];
for(int i=0;i<sonido.length;i++){
sonido[i]=sonido.generateSound[opcNotes];}
for(int i<0;i<sonido.length;i++){
sonido[i].play();
for(int j=0;j<numtries;j++){
if(){continue;} //If i press the "next" button, ill go to the
//next iteration
else if(){ //If i press the "play again" button, ill do the
//action again
numtries++;
sonido[i]().play
}
}
解决方案
推荐阅读
- python - 使用日期作为 x 轴增长 matplotlib 条形图
- cordova - 404(未找到)播放本地视频文件 ionic cordova
- perl - 为什么有些用户在 Perl 中引用类名?
- javascript - Javascript 代码是否通过引荐流量
- javascript - 从日期选择器获取日期未按预期工作
- javascript - 尝试 ES6 样式导入会给出“不能在模块外使用导入语句”
- lit-element - lit-html / lit-element 中的类似 React 的引用?
- sql - 需要根据 ID 和日期更新
- amazon-web-services - 从远程状态重建/重新创建 terraform
- c# - 在 Power Bi 查询函数中进行 POST REST API 调用以生成令牌,并使用该基于 JWT 的令牌进行另一个 GET API 调用