Open NetBeans IDE 6.9.1
On the Main Toolbar select Tools->Options
Click on Editor and then on the Code Templates tab
Click on the New button to create a new **Code Template
**
Give it a Abbreviation and click **OK
**
In the Expanded Text tab type in your Code
In the Description Tab give the Code a description
In the Language Combo Box select the language for the Code Template
Expand Template on: select Tab within the Combo Box (This will be used to auto-complete your Code Template)
Click OK
To use your code snippet go to the Editor and type the exact Abbreviation for you Code Template and press the Tab key to auto-complete your code.