Editing and Debugging BlueJ projects in NetBeans using the BlueJ Plugin

The NetBeans editor is much more sophisticated than the BlueJ editor, allowing the user to navigate to the declaration of a method from any mention of it(right-click and select Find Usages), safely rename a variable (select the name, hit Ctrll+R and type the new name), and so on. Particularly, dynamic compilation of code is enabled, so that if (for instance) you delete a semi-colon from the end of a line of code in the body of the UserInterface constructor, an icon quickly appears to indicate an error. Mousing-over the line will reveal the error message.

NB syntax error marker

The screen shot above also shows the NetBeans "code folding" marker, which allows method bodies, or comments to be hidden temporarily.

As in BlueJ, the NetBeans editor is used to manage breakpoints for debugging purposes. A breakpoint can be toggled for a source line by left-clicking in the editor margin next to the source code. Unlike BlueJ, NetBeans does not automatically honour breakpoints when a program is run. If you want to halt when a breakpoint is reached, you must execute your program using the Run/Debug Main Project menu item. When a breakpoint is reached, the current program state is displayed in a dialog box at the bottom of the NetBeans main window, and the continue/step controls are displayed on the NetBeans toolbar.