They've been in a war for 60 years.
Besides, Hamas is odd in that it is more than a terrorist organization. It is the legitimate democratically-elected ruling party of Palestine (well, Gaza). It has been a provider of social services for decades. It sends kids to school. It does a lot of things that endears it to the local population. And as a side note, they at least have stopped suicide bombings since 2005. Small victories for sanity, I guess.
It's very rare that peaceful movements work without a real or imagined threat of violence behind them. I actually can't think of any off the top of my head. Besides, do you really expect a group of people who have been evicted from their homes and have been living in utter poverty and squalor to smile and be happy towards people they view as invaders and occupiers? That's not how the real world works. I'm not trying to justify the actions of Hamas and other similar organizations but what they are doing is the logical consequence of Israeli policy - something people in the Israeli government are fully aware of.
As BN just said, Israel hasn't been doing a hearts and minds style campaign. It's the only way to win these sort of conflicts. The British did it in Malaya (although there are many differences between these two conflicts the lessons learned apply). The British failed to do it in Aden. The French failed to do it in Indochina. We failed to do it in Vietnam. My main complaint with Israeli policy is that there is a body of literature and experience on how to do this sort of thing and they have usually ended up ignoring it. And what happened when they had someone in power who generally and truly wanted peace? Yitzhak Rabin was killed by his own people.