java - in the mouse click method when i call the method get X() and get Y() it return -8 regardless the position -


public void mouseclicked(mouseevent e) {         system.out.println("mouse click working");         system.out.println(getx());         system.out.println(gety());      } 

you're calling getx() , gety() on containing class, not on mouseevent.

e.g. need

e.getx(); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -