In this parable Jotham describes the trees doing things that humans do. (See: [[rc://en/ta/man/jit/figs-parables]] and [[rc://en/ta/man/jit/figs-personification]])
Here, to anoint with oil is a symbolic action that represents appointing a person to be king. Alternate translation: "to appoint a king to rule over all of them" (See: [[rc://en/ta/man/jit/translate-symaction]])