Initializing a component in an application.
Posted on 1997-04-06
I am trying to draw graphics in a frame. I tried using:
Component drawInto = new Canvas();
Graphics g = drawInto.getGraphics();
There is more code obviously, but since this is an application and not an applet, I don't know how to initialize the component. The frame comes up, but I don't get a Canvas or a line. If I try paint(Graphics g), the program compiles correctly, but I get a nullpointer error when I try to execute the program. Any answers?