If Shakespeare's Hamlet, at its heart, is about how a just human should or has to behave in an unjust world--or if it is about how an incorrupt human should or has to behave in a corrupt world--then Hamlet and his father are on one side, and Claudius is on the other.
Thinking of Hamlet as someone who can't do anything without speechifying or thinking of killing himself is unsophisticated and simplistic, at best. Hamlet just isn't willing to rashly kill a man when there's a chance that that man might be innocent, as Laertes and Fortinbras are willing to do later. Hamlet is a just man in an unjust world, an incorruptible man in a corrupt world. He doesn't lightly kill a king who is the representative of God--not without proof.
Claudius, on the other hand, is unjust and corrupt. He assassinates a representative of God, commits incest to gain the throne, and orders Hamlet to be executed in order to protect his throne.
And apparently, according to Hamlet, his father was the same kind of man he is. Hamlet and his father are contrasted with Claudius in that they are just and incorruptible, and Claudius is unjust and corrupt.
In addition to the superb answer above, King Hamlet & the Ghost can be juxtaposed with Claudius in terms of their own language and actions and not just on Hamlet's obviously biased soliloquy.
Both have killed to gain or maintain power. King Hamlet killed Old Fortinbras to gain lands in Poland. Claudius obviously kills King Hamlet to get the throne.
Both loved Gertrude. The Ghost tells Hamlet to leave her to heaven, and Claudius tries to get her to stop drinking the poisoned chalice.
Both are blind. King Hamlet was blind to his wife and brother's incest and adultery. Claudius is blind toward Hamlet and the effects of his incestuous and murderous crimes on the state.
Both form unnatural relationships. The Ghost, a supernatural being, elicits a mortal (his son, no less) to carry out what he should do (haunt Claudius). Claudius' relationship with Gertrude is full of incest, adultery, deceit.
Both want revenge. King Hamlet wants revenge on Claudius, and Claudius wants revenge on Hamlet. They both incite Hamlet to enact revenge.
Both use pawns as part of revenge. The Ghost uses Hamlet to carry out his plan, while Claudius uses Polonius' family, R & G. All of their pawns, by the way, die.
King Hamlet (Ghost) will go to heaven, and Claudius will go to hell. The former is a victim of immorality, while the former is an agent of it.
The Ghost is a better performer than Claudius. His lines are war-like, gothic, menacing. Claudius, especially at prayer, seems much weaker by comparison.
The two are contrasted particularly in the soliloquy which Hamlet gives at the end of Act I, scene ii:
So excellent a king, that was, to this,
Hyperion to a satyr; so loving to my mother
That he might not beteem the winds of heaven
Visit her face too roughly. Heaven and earth!(145)
Must I remember? Why, she would hang on him
As if increase of appetite had grown
By what it fed on; and yet, within a month—
Let me not think on't! Frailty, thy name is woman—
A little month, or ere those shoes were old(150)
With which she follow'd my poor father's body
Like Niobe, all tears—why she, even she—
O God! a beast that wants discourse of reason
Would have mourn'd longer—married with my uncle,
My father's brother, but no more like my father(155)
Than I to Hercules.
In this passage alone, Hamlet makes two comparisons, one that his father was more like Hyperion than Claudius who was in fact much more like a half-man half-goat with a lusty attitude and poor manners. His father was so caring to his mother that he wouldn't have the wind blow on her face too roughly.
He goes on to say that Claudius is no more like Hamlet Sr. than Hamlet to Hercules, in this case also commenting on the fact that Hamlet is not a man of action or great strength and resolve as Hercules and his father were. If we think of Hercules' willingness to take on seemingly impossible tasks we see the contrast as Hamlet isn't even willing to do much of anything before he speechifies about it a lot and considers just killing himself instead.