The computer may be taking in too much input or there could be a malfunctioning program or application.
Since you can't restart the computer on-screen, the best way to fix this is to do a hard reset by either holding down the power button until the computer totally shuts off, or by removing the battery.
After this, it may also be good to do a system restore to a time before your computer froze to make sure that there weren't any changes to your computer that caused the freeze.