开发者

acm.graphics library - Applet starts instead

I'm trying to use the ACM library, my source code looks like this. On running it the Applet is started, but the output is still in the console within Eclipse. It is supposed the app to be started in a standalone window, not in the console. What I'm doing wrong?

import acm.graphics.*;
import acm.program开发者_开发问答.*;
import acm.util.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class Breakoutme extends GraphicsProgram {

    public void run() {
        println("Hi there");
    }

}


Change GraphicsProgram to ConsoleProgram, and it will work.


println will not produce output in Applet window. I honestly think you have no idea what you're doing. Breakout is supposed to be all graphics, why are you using println?


You have to add a GLabel in order to do that.

GLabel hiThere = new GLabel("Hi There", 40, 40);

add(hiThere);

but you can do the same in a ConsoleProgram but instead of println() you have to use print()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜