【发布时间】:2016-10-14 12:01:45
【问题描述】:
我正在使用来自this answer 的代码,但我在更改第一个小程序的大小时遇到了问题。更改 size(100, 100) 的值没有任何作用。我该如何解决这个问题?
public void setup() {
size(100, 100);
String[] args = {"TwoFrameTest"};
SecondApplet sa = new SecondApplet();
PApplet.runSketch(args, sa);
}
void draw() {
background(0);
ellipse(50, 50, 10, 10);
}
public class SecondApplet extends PApplet {
public void settings() {
size(500, 500);
}
public void draw() {
background(255);
fill(0);
ellipse(100, 50, 10, 10);
}
}
【问题讨论】:
-
小程序的大小在 HTML 中设置。小程序不应该尝试第二次猜测 HTML 为其指定的大小。 Aslo: 1) 为什么要编写小程序?如果是老师指定的,请参考Why CS teachers should stop teaching Java applets。 2) 见Java Plugin support deprecated 和Moving to a Plugin-Free Web。
标签: java applet processing window-resize