If you're looking to do this at an O/S level (i.e. it happens in every application) you're going to have to "go native". If you're looking to do it in a single Java application, take a look at...