How to collapse comments in NetBeans template?

I'm somewhat of a novice programmer, and would like to include some tips in my NetBeans code by building a custom template. However, my tips are... a bit on the long side. I decided to solve that problem by adding a tag above them in one line comments, something like //@Djikstra's. I want those comments to be automatically folded so that I don't have to scroll through hundreds of lines of code to get to the real code. How should this be done? Pictures below should help illustrate this problem.

What the thing looks like in template

This is what one tip looks like in template.

What it should look like after auto-generation

And this is what a tip should look like after auto-generation.

Upvotes: 0

Views: 314

Answers (1)

D.Salter
D.Salter

Reputation: 231

It you add an editor fold around a comment, you can make it collapsed by default. For example:

// <editor-fold defaultstate="collapsed" desc="Handy tip">
/* start of comment
  This information is useful...
*/
// </editor-fold>

The key here is setting the defaultstate to collapsed which causes the comment to be collapsed when the file is first opened.

Upvotes: 1

Related Questions