SurroundWithCodeFolding

Surround with Code Folding

Code folding is a neat little feature that allows you to hide blocks of code, making a source file more readable. The XML syntax used by NetBeans isn't easy to remember, but this little trick will make it as easy as it gets:

1. Go to Tools> Options> Editor> Code templates

2. Click New, enter "cf" as the abbreviation, then enter the following code as the expanded text:

// <editor-fold defaultstate="collapsed" desc=" ${DESCRIPTION} ">
${selection line}${cursor}
// </editor-fold>

3. In the description tab, enter "Code folding", and click Ok


Now, if you select multiple lines of text in the editor, you will get the "light bulb" icon in the margin. Click it, and you'll get the option "Surround with Code folding". Select it, enter a description and you're done.

File:code-folding_SurroundWithCodeFolding.png

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo