The problem is you're
looking for OS-level knowledge of these events which of
course Java doesn't provide, mainly for security
reasons. If you really need to examine all keyboard and
mouse events system-wide (which in itself is no small
task) Java will be unable to do what you want. C++
might be able to do it, although I don't envy you the
task of figuring out how (keeping in mind that all
keyboard and mouse events must also be passed to the
proper application as well as "seen" by yours). I don't
believe there's any cross-platform way to do such a
thing.