I have a line that I want to be drawn from the player x and y towards the mouse x and y but I want it to just go in the direction of the mouse cursor (I don't want it to be drawn from the player to the mouse but from the player towards the mouse and the go beyond the mouse). I get the mouse position by using the code below.
PointerInfo mouse = Mouse.getPointerInfo();
Point point = new Point(mouse.getLocation());
I the draw the line with this code.
g2d.draw(new Line2D.Double(player.getX() + 32, player.getY() + 32,
point.getX(), point.getY()));
This only make it so that the line is drawn between the player and the mouse but how would I make it go beyond the mouse so that it will travel out of the screen?