Hi there,
Ich am writing an Applet consisting of multiple .java Files.
My Main.java File (extends Applet) konstructs an objekt out of the Animation.java file/class (doesn’t extend anywere).
The animation constructor calls the constuctor of a subclass “Scale” (extends Canvas).
The Animation class has a method called refresh(). This calls another refresh() Method within the Scale-class. I put a System.out.println(“Hello World, my name is Scale.refresh()”); in there and that is displayed.
After refresh() (The one in scale) has done some calculations is calls repaint(). I put a System.out.println("…"); in the scale’s paint(Graphics g) method but this is never displayed in the console.
If I try to put an add(scale); (I called the objekt from Scale scale) in the Animation constructor Eclipse outputs the following error message:
The method add(Animation.Scale) is undefined for the type Animation Animation.java
Why isn’t scale’s paint method called?
(Please feel free to just make suggestions if you don’t know a working answer because I need to get this finished today.)
Btw.: Extending Animation to Canvas and then adding the Animation-objekt in the Main class (that works) doesn’t solve my problem.