• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

get constant parameter from mouseEvent

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();

}
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My programm is to dragged a vector and and calculate the vector length so I need constant parameter
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about a MouseListener?
 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic