When I create a new class for instance, I get this:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
pack
Also there's the JIndent plugin.
In Netbeans go to Tools > Options. Then select the Formatting tab and select Java under the language drop down.
There are now several options to change the formatting the way you like it.
Simply follow these steps:
Tools -> Options -> Editor
Editor -> Formatting