This is a homework assignment that I'm have some trouble with. Since it's an assignment, I was wondering if someone could kind of lead me in the right direction but not give me the answers. The two files are below, java and class. Class
lol, really sorry about that. I forgot to include my list of problems that are occurring. First of all, a smiley face is supposed to show and does, but when you choose for it to be sad it just draws the angled sides of the mouth and nothing else.
The way your erase method works is a bit dangerous - you're drawing the face as white over top of the current face. On top of that, your erase() calls draw() and then you call draw() yourself. Java is not command line. It sounds weird, but it's possible that the erase's call to draw() might be coming after your own call to draw(). In other words it would draw the sad face and then draw the "erase" happy face on top of it. The infinite loop is dangerous as well and may be contributing to the problem. Consider learning how to use event listeners as while(true) rarely gives positive results.
A good workman is known by his tools.
posted 15 years ago
What's an eventListener and how can I use one in my case?
I assume you are writing an applet. Being that this is a homework assignment also leads me to assume you have a textbook. Any Java textbook should have a bit on event listeners - that would be a good source for learning. I really can't give much more advice without knowing how your program is designed, if you're using Swing, etc.