Front of knee is generally referred to as patellofemoral syndrome. Can be caused by many things. Can be 2-3 days or a few weeks. Generally overuse injury, or training too much too soon. Upping training volume all of a sudden. It's a common injury with a lot of triathletes.
I have just recently had this. The fix: Ice, rest and plenty of massage. Do not run for a week, then very easy run/walk for a week. Light spinning on the bike only for two weeks. No climbs, no turbo work. If you have rollers, then ride on those, they are ideal for very light pedalling. If you need harder aerobic workout then chance now to work your swim training more.
Take time is the most important thing. Once the pain has gone, do not be fooled and try to get straight back to hard training, as it will return immediately. Before you do, strengthen and flex your quads. Make sure your hamstrings are flexible. Pain in the knee is very rarely the source of the problem. Generally it is a biomechanical thing, so really get your legs strong and flexible once pain free and you will be able to get back to normal. Ease your way back to full training and after around 4 weeks, if sensible, all will be ok.