questo è il tutorial della sun:

http://java.sun.com/docs/books/tutor...ing/index.html

per il resto posta il codice