I'm assuming that you're trying to overwrite the x and y class values in the following code:
Code:
public void mousePressed(MouseEvent event){
int x = event.getX();
int y = event.getY();
...
However, you're not doing this as you've declared these 'x' and 'y' variables, thereby making them *local* variables. Also you class variables 'x' and 'y' are declared as final:
Code:
private static final int x = 100;
private static final int y = 100;
Lastly, I would suggest you make 'MousePressListener' extend 'MouseAdapter', that way you don't need to declare all those unused methods:
Code:
public void mouseReleased(MouseEvent event){}
public void mouseClicked(MouseEvent event){}
public void mouseEntered(MouseEvent event){}
public void mouseExited(MouseEvent event){}
Bookmarks