An important method of transforming uncomfortable or unacceptable feelings into something more manageable is 'reaction formation', which is the superficial adoption and exaggeration of ideas and impulses that are diametrically opposed to one's own.
For example, a man who finds himself attracted to someone of the same sex may cope with the unacceptability of this attraction by over-acting heterosexual: going out for several beers with the boys, speaking in a gruff voice, banging his fists on the counter, whistling at pretty girls (or whatever people do these days), conspicuously engaging in a string of baseless heterosexual relationships, and so on.
Other, classic, examples of reaction formation are the alcoholic who extolls the virtues of abstinence, the rich kid who organizes anti-capitalist rallies, the absent father who occasionally returns with big gestures to spoil and smother his children, and the angry person who behaves with exaggerated calm and courtesy.
An especially interesting case of reaction formation is that of two people who matter deeply to each other, but who argue all the time to suppress their mutual desire and dependency. Typically, A accepts that B is really important to him, but B does not accept this of A; thus, B initiates arguments so as to help deny those feelings, and A initiates (or participates in) arguments so as to help cope with that denial, that is, to safeguard her ego, vent her anger, and temper her feelings.
Another, rather special, case of reaction formation is the person who hates the group but not the individual members of the group with whom he is personally acquainted; this helps to explain such phenomena as the misogynist who is devoted to his wife or the racist who marries a coloured person.
Behaviour that results from reaction formation can be recognized—or as least suspected—as such on the basis that it tends to have something of a manic edge, that is, it tends to be exaggerated, compulsive, and inflexible. More importantly, perhaps, is that the person's behaviour does not seem to ‘add up' in the context of his bigger picture, and may therefore appear to be groundless, irrational, or idiosyncratic. In many cases, the behaviour is also dystonic, that is, out of keeping with the person's ideal self-image, and therefore damaging to his deep-seated goals and ambitions and—ultimately—to his sense of worth and his actual worth.