【发布时间】:2014-10-28 22:32:29
【问题描述】:
import java.applet.Applet;
import java.awt.Graphics;
public class MyApplet extends Applet {
public void paint(Graphics g) {
System.out.println("This the test.");
g.drawString("This the test.", 10, 20);
}
}
控制台的输出是:
This the test.
This the test.
【问题讨论】:
-
tp 类中是否有启动、停止方法?你可能从哪里调用 repaint()。
-
你在哪里调用这个方法?
-
我在 netbeans IDE 中运行了这个程序。将此视为完整程序。当我运行这个程序时,你的第一个控制台输出如上所示。每次我最小化和最大化绘制方法运行的窗口时。我理解那件事。但是为什么它第一次运行两次。我试图调试,但我没有从中得到任何东西。请帮我解决这个问题。
标签: java