In the Source Editor, a hint is displayed when the IDE performs source code analysis and detects common syntax errors or problems.
An editor hint is available if a lightbulb icon appears in the left margin of the Source Editor while you are developing your code. You can read the hint by clicking the lightbulb icon or by pressing Alt-Enter. You can generate the code suggested by the hint by clicking the hint or by pressing Enter.
You can select which hints to display when you type in the Source Editor in the Hints tab of the Editor panel in the Options dialog box. You can access it by choosing Tools > Options from the main IDE's menu, and then clicking the Editor category.
You can use hints when running source code inspections on a selected file, package, or project and refactoring your sources.
To initiate the Inspect operation:
Choose Source > Inspect from the main IDE's menu.
In the Scope drop-down list of the Inspect dialog box, select a file, package, or project(s) to be inspected.
Select either of the following to use:
In the Configuration drop-down list, select NetBeans Java Hints to choose all hints available in the IDE to be used in the source code analysis.
Alternatively, click Manage to open the Configurations dialog box and specify a set of hints to be used in the source code analysis. Click OK.
Select Single Inspection and choose a single hint to be used in the source code analysis.
Click Inspect to perform the source code analysis.
After the Inspect operation is completed, the hints that can be applied to your code are displayed in the Inspector Window below the Source Editor.
To initiate the Inspect and Transform operation:
Choose Refactor > Inspect and Transform from the main IDE's menu.
In the Inspect drop-down list of the Inspect and Transform dialog box, select a file, package, or project(s) to be inspected. Alternatively, click the button to the right to open the Custom Scope dialog box and specify the custom code to be inspected.
Select either of the following to use:
In the Configuration drop-down list, select a predefined configuration of hints available in the IDE (for example, Convert to JDK 7) to be used in the source code analysis.
Alternatively, click Manage to open the Manage Inspections dialog box and group a set of hints into a configuration to be used in the source code analysis. Click OK.
Select Single Inspection and choose a single hint to be used in the source code analysis.
Click Refactor to run the source code analysis.
After the Inspect and Transform operation is completed, the results are displayed in the Inspect and Transform dialog box. Click Preview to display the source code refactorings proposed by the IDE upon conducting the source code analysis with the hints you specified.
Check the complete list of hints available in the IDE at the Java Hints wiki page:
For information on how to create a NetBeans module that provides one or more Java hints, see: