Book Image

Mastering Netbeans

5 (1)
Book Image

Mastering Netbeans

5 (1)

Overview of this book

Table of Contents (17 chapters)
Mastering NetBeans
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Code folds


Splitting windows either horizontally or vertically is an excellent way to utilize screen space when it is necessary to compare two sections of a file. Using code folds is another excellent technique for "folding" or "collapsing" sections of code, thus helping to provide more screen space. With a code fold, pressing the + or buttons on the left-hand side margin expands or collapses the code and can, therefore, be used to get more code onto the current view of a file.

Creating a code fold is simply a matter of placing an especially formatted comment around the piece of code that requires folding, as shown in the following code snippet:

    // <editor-fold desc="Variable definitions">
    int foo;
    String bar;
    // </editor-fold>

The <editor-fold> XML defines that the enclosed code will be available within NetBeans as a code fold and has several attributes, all of which are optional:

  • desc: It is the description that is displayed within the NetBeans code editor...