Hamlet, ACT I, Scene 3:
Picking up on the backstory extravaganza that occurs in Act I of this five-act play, we skip to the inside of Polonius's house, where we first meet Ophelia. In some stage and movie productions of the play, she is among the guests in the big party scene of Act I, scene 2, but she has no lines until Scene 3, so she doesn't actually "need" to appear until now. And depending on the particular time period used to set the play and on the "take" of the actors and director, there can be valid reasons for keeping the fair Ophelia at home, depending on how young the character is supposed to be, and on whether she is supposed to be a virginal maiden or not. (Somewhat similar to considerations in Regency and Victorian times as to whether a young woman was "out" in society or not.) But I digress.
So, here we are in Polonius's house, where we first meet Ophelia, who is having a conversation with her elder brother, Laertes. Laertes is about to board a ship to France, and has decided to provide rather overbearing advice to his sister, through which we learn a little something about Ophelia and the nature of her relationship with Prince Hamlet.
Backstory and foreshadowing, courtesy of Laertes
Right off the bat, Laertes tells Ophelia not to rely on Hamlet's love and affection. He claims it's a youthful infatuation, no more and will fade. In doing so, he specifically invokes the image of the Violet. He seems to imply that Hamlet's love will wilt, the way that violets do.
However, Shakespeare's audiences would've been better versed in the meaning of flowers than are modern readers, and they might have seen the flaw in Laertes's logic. Let me tell you a bit about the violet: violets in general mean humility or faithfulness, blue violets have the meaning of "watchfulness", and sweet violets have the additional meaning of "modesty". Shakespeare's audience would also have been familiar with the story about Cupid and Venus, in which Venus asked Cupid who was more beautiful - herself or a group of young maidens. Cupide favored the maidens, so Venus beat them until they turned purple-blue, and they were turned into violets. Not exactly a happy history with that flower.
It seems likely, therefore, that Shakespeare's audiences would understand that if it was violets that best symbolized Hamlet's affection, then he was faithful to her. They might also have suspected that the use of violets here presaged some violence for poor Ophelia, given that the violets were negatively dignified (to borrow a term from the Tarot) by virtue of being spoken of slightingly and as if they were a weak flower rather than a vital harbinger of spring time, since they are perennials that come back, and were known to have healing properties - real ones, too, as it turns out that violets contain salicylic acid. And Laertes's mention of violets in his conversation with his sister foreshadows her connection with flowers later on - Ophelia herself mentions that the violets all withered with her father's death, which could mean that Polonius was the watchful one, but is now gone, or that her humility and modesty all disappeared after his death. But again, I digress.
Laertes continues with advice to Ophelia, beginning by telling her that Hamlet might not be free to marry where he chooses, and then steering into words that border on the obscene, if you have an Elizabethan understanding of their double meanings. He warns Ophelia of the risks of venereal disease in a sixteen-line passage beginning with "Then weigh what loss your honor may sustain . . . " and continuing through mentions of chaste treasure, the "rear of her affection", the "shot and danger of desire", strokes, buttons, and liquid dew, along with cankers and blastments and whatnot.
Backstory of Hamlet's relationship with Ophelia
After Laertes sails off, Polonius questions Ophelia about the nature of her relationship with Hamlet. There are double entendres here, as well, that can be taken to mean that Ophelia has been engaged in a sexual relationship with Hamlet, but that she believes it to be based in true affection, whereas her father thinks she's merely being used.
Polonius tells Ophelia (and thereby the audience) that he hears Ophelia's been spending an awful lot of time alone with Hamlet, and he wants to know the full story. Ophelia acknowledges the relationship, explaining that Hamlet has declared his affection, treated her honorably (although Ophelia's language can be interpreted as meaning that they've had a sexual relationship, based on double meanings, the plain meaning is more innocent) and made to her "almost all the holy vows of heaven". Polonius commands Ophelia not to spend any further time with Hamlet, claiming that Hamlet just wants to get in her knickers. That last reading holds regardless of whether you believe Ophelia and Hamlet have already been knocking boots.