A 43-year-old sheriff has been taken into custody without incident in rural Kentucky after allegedly shooting dead a 54-year-old judge inside a courthouse.