rendered paste body public void onMouseDrag(Location p) { if ( (Math.abs(lastMouse.getX()-p.getX() ) ) < Math.abs( (lastMouse.getY()-p.getY() ) ) ) { FilledRect Stick = new FilledRect( (canvas.getWidth()/10)*Math.round(p.getX()/(canvas.getWidth()/10))-1.5, (canvas.getWidth()/10)*Math.round(p.getY()/(canvas.getWidth()/10)), 3, (canvas.getWidth()/10), canvas); Stick.setColor(Color.BLACK); Stick.sendToBack(); } else { FilledRect Stick = new FilledRect( (canvas.getWidth()/10)*Math.round(p.getX()/(canvas.getWidth()/10)), (canvas.getWidth()/10)*Math.round(p.getY()/(canvas.getWidth()/10))-1.5, (canvas.getWidth()/10), 3, canvas); Stick.setColor(Color.BLACK); Stick.sendToBack(); } }