1

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");
    }

}
Robin Green
  • 32,079
  • 16
  • 104
  • 187
Eugene
  • 59,186
  • 91
  • 226
  • 333

3 Answers3

0

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?

0

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

Change GraphicsProgram to ConsoleProgram, and it will work.

Christian Neverdal
  • 5,655
  • 6
  • 38
  • 93