, , .
startX, startY, endX endY.
X startX endX, Y , startY.
,
Line line = new Line(10,10, 80,80);
int startX=10, startY=10, endX = 80,endY=80;
int positionX=ball.getX(), positionY=ball.getY();
if( positionX <= startX && positionX <= endX && positionY <= startY )
ball.stop();