• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get constant parameter from mouseEvent

 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will to ask my question better

I try this code to get x,y paremeters, but I want constant parameter and not a parameters that change all the time
How can I do it

public void init()
{


addMouseMotionListener(this);
}

{
public void mouseMoved(MouseEvent me)

xpos = me.getX();
ypos = me.getY();

}
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless your mouse is scotched to your desk (in which case the mouseMoved event would not be fired), its coordinates will obviously change.

What are you trying to achieve exactly ?
 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My programm is to dragged a vector and and calculate the vector length so I need constant parameter
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about a MouseListener?
 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okey it is worked better now.
but what about if I want two or more vectors so I need to maintain the former parameters?
 
Kevin Workman
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alona ariel wrote:okey it is worked better now.
but what about if I want two or more vectors so I need to maintain the former parameters?


Use a List? I'd recommend you go through the basic tutorials again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic