• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a shape to a canvas

 
Malcolm Whitely
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I've got a class that extends Thread and performs a simple animation by redrawing an oval every fraction of a second. What it actually does is that it sets the circle's color at the previous location to white and then recreates it with its normal color at the new position.
I have tried to add this to a canvas, or any other container for that matter, but to no avail. Note that I am not using the repaint() method.

I've defined a canvas in my main class (which extends Applet) as such:

I'm simply trying to add an object of type Graphics 'g' (from my other class) to the canvas. I've tried myCanvas.add(g), add(myCanvas); but doesn't seem to be working.

Any help would be greatly appreciated.
 
saager mhatre
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't quite get your problem or your class structure.
Could you put up your entire class source code?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic