Hi I'm currently writing a pool game which is nearly done. I am having an issue positioning the cue so that it lines up as the user moves the cursor near the cue ball. The cue currently appears to the right of the cue ball once the mousePressed() method is enforced and this is because the positions have been hardcoded. The cue ball (when the mouse button is released) moves in a straight line away from the cursor so my angles are working. I know this isn't that difficult but I've just drawn a blank for some reason so if anyone can help me solve it I'd be very grateful.

Here is my drawCue() method:

Java Code:
         public void drawCue(Graphics g){
		g.drawLine((int)this.getX()+ 15, (int)this.getY()+15, (int)this.getX() + 55, (int)this.getY()+ 55);
Here is my mousePressed() method:

Java Code:
        public void mousePressed(MouseEvent e) {
		xPressPosition = e.getX();
		yPressPosition = e.getY();
		if(xPressPosition - b[0].getX() > Ball.getRadius() || yPressPosition - b[0].getY() > Ball.getRadius())
			System.out.println("The mouse press must happen on the cue ball only!!!");
			mouseDrag = true;
And finally here is my mouseReleased() method:

Java Code:
 public void mouseReleased(MouseEvent e) {
		double dragDistance = 0;
		if(mouseDrag == true) 
		double xReleasePosition = e.getX();
		double yReleasePosition = e.getY();
		dragDistance = Math.sqrt((Math.pow(xPressPosition-xReleasePosition,2) + Math.pow(yPressPosition-yReleasePosition,2 )));
		System.out.println("Drag distance is " + dragDistance);
		initialSpeed = dragDistance*0.1; 

		System.out.println("Initial speed is " + initialSpeed);
		initialDirection = Math.toDegrees(Math.atan(-(b[0].getY() - e.getY())/(b[0].getX()-e.getX())));
		if(initialDirection<0 && e.getY() > b[0].getY())
		else if(e.getY()<b[0].getY()&&e.getX()>b[0].getX())
		else if(e.getY()<b[0].getY()&&e.getX()<b[0].getX())
		System.out.println("Initial direction is " + initialDirection);
		initialVelocity = new Vector2(initialSpeed*Math.cos(Math.toRadians(initialDirection)),initialSpeed*Math.sin(Math.toRadians(initialDirection)));
		System.out.println("Initial velocity is " + initialVelocity);
		mouseDrag = false;