JAD
2008-01-27 17:44:18
Hmm.. So I'm making a java applet mini game (I'm a java noob :p) and I'm having problems with this:
So, what that's supposed to do is this. In my paint method, I have just a circle moving back and forth across the screen, buy subtracting and adding to the x1 variable. When the circle (x1) is between 21 and 54 x coordinate, and the user clicks the mouse, I want the script to do what I put between the brackets. I tried it, and it doesn't work. I had the script do something if blah was true and it never did it because I probably did something wrong.
Any help would be appreciated.
I'm a little confused when working with applets because there's no "main method" with them. I really don't think I get when MouseClicked is called. Will it just do what was put in that method when the mouse is clicked or do I have to call for MouseClicked in the paint or run methods?
Thanks.
public void mouseClicked(MouseEvent me)
{
while(x1 > 21 && x1 < 54)
{
blah = true;
repaint();
}
}
So, what that's supposed to do is this. In my paint method, I have just a circle moving back and forth across the screen, buy subtracting and adding to the x1 variable. When the circle (x1) is between 21 and 54 x coordinate, and the user clicks the mouse, I want the script to do what I put between the brackets. I tried it, and it doesn't work. I had the script do something if blah was true and it never did it because I probably did something wrong.
Any help would be appreciated.
I'm a little confused when working with applets because there's no "main method" with them. I really don't think I get when MouseClicked is called. Will it just do what was put in that method when the mouse is clicked or do I have to call for MouseClicked in the paint or run methods?
Thanks.