aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes get constant parameter from mouseEvent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "get constant parameter from mouseEvent" Watch "get constant parameter from mouseEvent" New topic
Author

get constant parameter from mouseEvent

alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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 ?


[My Blog]
All roads lead to JavaRanch
alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
My programm is to dragged a vector and and calculate the vector length so I need constant parameter
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
What about a MouseListener?
alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
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

Joined: Sep 28, 2010
Posts: 151
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get constant parameter from mouseEvent