"…for there is nothing either good or bad, but thinking makes it so." Hamlet Act 2, scene 2
In context it may be nothing to do with ethical relativism but rather more to do with whether or not you enjoy your current circumstances depends upon your state of mind. For Hamlet Denmark is a prison. However, many writers have traced this thought back to others. Kenneth Muir's
Shakespeare Survey (p41) says "Hamlet's assertion of relativity…can be traced back to Lyly or Spenser, to Cardan, Baldwin or Nicholas Ling…but though the statement in
Politeuphia (1597) — 'There is nothing grievous if the thought make it not so"— seemed to Wilson 'closer to Hamlet in wording and in date', one may still think with Robertson that in Hamlet it is no incidental or wayward utterance: 'we find the formula felt', as in Montaigne who devotes a whole chapter to the notion 'That the taste of goods or evils dothe greatly depend on the opinion we have of them.' (Essays)
(n.b. Wikipedia has a good paragraph on the philosophical background to Hamlet.)