NetBeans-SCSNI

5.3-Describe the ways that the IDE highlights errors in source code and the tools the IDE offers for correcting those errors.

How to use the Error Stripe

  • The editor uses the error stripe on the right side of it to show information about interesting places in the code. These places include, for example:
    • The current line
    • Errors
    • Warnings
    • Highlights (like usages of members or method exit points)
    • Places where the code has been changed
    • ...

The places are represented by small stripes of different colors.

How to add import statements for one or more classes

There are several ways to add import statements.

  • Use error hints: Click on the error mark with the light bulb or press Alt+Enter. It will offer you a list of possible classes to import. Pick the proper hint and you are done.
HNT_AddImport.png


  • Use the import class dialog: Put the caret into the name of an unimported class and press Alt+Shift+I. A list of possible classes to import will appear.
HNT_ImportType.png

  • Use the smart fix import: Press Ctrl+Shift+I. You will get a dialog that lists all unresolved identifiers in the source. If there is more than one option for resolving the identifier you may choose using the combo box. Classes shown in gray do not fit for some reason. In the example below the Toolkit class in the com.sun.media.sound package does not have the method getDefaultToolkit(), which is called in the source.
HNT_SmartFixImports.png


-- Wagner R. Santos