There a lot of causes which could lead to pain and swelling in knee which can occur without any history of sudden trauma. These are-
From your description, the cause very likely seems to be dislocating kneecap with osteoarthritis. An X'ray is very essential and so is a consultation with an ortho doctor because of the presence of an obvious swelling, dislocating and hypermobile knee cap. This if untreated causes damage to the knee joint in the long run even if immediate pain and disability is less. Hope this was useful and you are welcome to ask doubts if any.