Stepping Through the Code
Using the debugger, you can locate and correct bugs in your
program. The following steps introduce you to debugging in the IDE.
To step through the code:
- Go back to the GUI editing workspace by clicking the GUI
Editing workspace button in the main window.
- Click line 26 in the Source Editor, which
contains the initComponents method.
- Choose Debug
Add/Remove
Breakpoint.
The line is highlighted to indicate a breakpoint was
set.
- Next choose Debug
Start
Debugger.
The program runs until it reaches the breakpoint. The IDE
switches to the debugging workspace, which displays:
- Information on the breakpoint in the Debugger window
- Messages from the debugger in the Output window
The next method call is highlighted.
- Choose Debug
Step Out.
The first line in the main method is
highlighted.
- In the Source Editor, click the line with the initComponents
method and then choose Debug
Add/Remove
Breakpoint.
The breakpoint is removed.
- Finally, choose Debug
Finish
Debugging to end the debugging session.
Legal Notices