Joptionpane不使用椭圆功能
我认为代码没有任何问题,但是在循环完成之前,它并没有以某种方式显示椭圆。
我的代码是:
import javax.swing.JOptionPane;
void setup() {
size(500, 500);
background(255);
}
void draw() {
for (int i = 0; i<5; i++) {
JOptionPane.showMessageDialog(null, "you win!");
ellipse(150, 150, 150, 150);
delay(3000);
}
}
感谢您提前的帮助
I don't think there is any problem with code, but somehow it is not showing the ellipse before the loop is done.
my code is:
import javax.swing.JOptionPane;
void setup() {
size(500, 500);
background(255);
}
void draw() {
for (int i = 0; i<5; i++) {
JOptionPane.showMessageDialog(null, "you win!");
ellipse(150, 150, 150, 150);
delay(3000);
}
}
thanks for your help in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
draw()
函数完成之前,您不会看到屏幕上的变化。您的代码循环 5 次,每次draw()
运行时延迟 3 秒,因此您只会看到屏幕每 15 秒更新一次椭圆。JOptionPane
不是问题。您应该重构代码以允许
draw()
正常更新屏幕。很难建议如何用您的示例来做到这一点,因为我不确定您的代码想要做什么。You won't see changes to the screen until the
draw()
function completes. Your code loops 5 times with a 3 second delay each timedraw()
runs, so you'll only see the screen update with the ellipse every 15 seconds.JOptionPane
is not the problem.You should restructure your code to allow
draw()
to update the screen normally. It's hard to suggest how to do that with your example because I'm not sure what your code is trying to do.