O'Reilly logo

NetBeans IDE 8 Cookbook by Rhawi Dantas, David Salter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Collapsing and expanding code folds

When you've written a lot of code, it's useful to be able to group sections of code together that can be collapsed and expanded at will. Code folds allow you to hide sections of code to make the code that you are looking at easier to understand. NetBeans allows any amount of code to be defined within a code fold, and indeed automatically generates code folds for comments, classes, and methods as will be seen in this recipe.

Getting ready

It is necessary to have a project with some Java code within it in order to see code folds in action. If you are unsure on how to create a project, please check the recipes in Chapter 1, Using NetBeans Projects. To help follow this recipe, when creating a project, enter CodeFolds ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required