I'm developing a website where I want a widget similar to what is used on the Stack Exchange sites for upvoting and downvoting.
Is it illegal if I use this? Does Stack Exchange have any patents on this?
No, Stack Exchange does not hold patents on voting (or on starring something). Voting on websites predated Stack Overflow by years.
However, that project's CSS design is re-using the Stack Exchange sprites wholesale, which is a copyright violation. If you use the same JS code on your site, make sure you don't reuse the CSS and images. Give the widget your own styling and you should be fine.
So, bottom line: using the idea is fine; using the design is not. That project will have to replace those sprites with images created from scratch. Stack Exchange would be well within their right if they asked that project to stop using the sprites they are using now.