PDA

Click to See Complete Forum and Search --> : Applet


amani
Jul 18th, 2001, 09:55 PM
Hey I want to place a Oval at random locations in the applet
I tried using the following logic but it is not placing the oval at different locations instead it is getting repainted at the same place
Can anybody out there has a solution .........Here is the code

public void mouseMoved(MouseEvent me){
showStatus("Mouse moving at "+me.getX()+ "'" +me.getY());
int rx =10*(int) Math.random();
int ry =10*(int)Math.random();
mouseX = (me.getX())*rx;
mouseY = (me.getY())*ry;

public void paint(Graphics g){
g.drawString(msg,mouseX,mouseY);

g.setColor(Color.blue);
g.fillOval(mouseX,mouseY,20,30);
}

Neti

amani
Jul 19th, 2001, 06:40 PM
any takers here?????????????

sail3005
Jul 19th, 2001, 10:11 PM
i think you might need an action listner for when the mouse moves

amani
Jul 20th, 2001, 11:19 AM
action listerner does not capture mouse events

I have another problem when I am changing a string value in applet it not displaying the new value it is still using the old value
any help out there

Neti

sail3005
Jul 20th, 2001, 11:29 AM
where is the code?

amani
Jul 20th, 2001, 02:05 PM
Hey I got it!! Solution is I need to restart browser instaed of reloading or refreshing

sail3005
Jul 20th, 2001, 02:34 PM
Woah, thats strange, but, whatever works :):P