1. Open NetBeans IDE 6.9.1

  2. On the Main Toolbar select Tools->Options

    Tools->Options

  3. Click on Editor and then on the Code Templates tab

    Options

  4. Click on the New button to create a new **Code Template

    **New Code Template

  5. Give it a Abbreviation and click **OK

    **New Code Template

  6. In the Expanded Text tab type in your Code

  7. In the Description Tab give the Code a description

  8. In the Language Combo Box select the language for the Code Template

  9. Expand Template on: select Tab within the Combo Box (This will be used to auto-complete your Code Template)

  10. 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.