SECTION 3
Navigation
Navigation
Tip 16: Navigate to Compile Errors
Sometimes you just want to see the big picture: Will this class compile or not? If not, where does
the bug start? Did I place the debugger breakpoint before or after that spot?
You can gather this type of information with one glance from the error stripe—even before you
have actually compiled the class. The error stripe is the area on the right side of the editor. It repre-
sents the whole file and also marks the current caret position ( ). Additional marks represent lines
with warnings (orange), errors (red), debugger breakpoints (pink), editor bookmarks (gray), and
highlighted occurrences (tan); see Figure 12.
The colored box at the top of the error stripe tells you immediately whether this class will compile
without warnings (green box), compile with warnings (orange box), or not compile at all (red
box). If the box is red, there will be red error marks in the error stripe. Clicking any mark will take
you directly to the appropriate line so that you can fix it.
When you run the project or compile classes, any compiler errors and warnings are displayed in
the Output window. Open the Output window by pressing Ctrl-4 (Mac: Command-4). Click into
the Output window and use the arrow keys to move the caret from one error to another: If the file
that contains the error is open, the Source Editor scrolls to the line containing the error. Instead of
using the arrow keys, you can also press F12 and Shift-F12 to jump to the next and previous error
in the file. The Output window renders lines with errors as hypertext links: Clicking a link will
also take you directly to the faulty line.
23
© 2009 Sun Microsystems. All rights reserved.
This publication is protected by copyright. Please see page 2 for more details.
100 NetBeans
IDE Tips & Tricks
by Ruth Kusterer
SECTION 3
Navigation
Tip Source
http://blogs.sun.com/roller/resources/roumen/editor_hidden.html
Tip 17: Navigate to Pending Tasks
Many programmers share the habit of marking buggy lines of code with a comment saying FIXME
or TODO. You too? Then try this: Go to the Window menu and select Task List. The Task List
24
© 2009 Sun Microsystems. All rights reserved.
This publication is protected by copyright. Please see page 2 for more details.
100 NetBeans
IDE Tips & Tricks
by Ruth Kusterer
FIGURE 12:
Colored marks,
warnings, and
errors in the error
stripe
SECTION 3
Navigation
window opens and lists (among other things) all lines that you marked as TODO or FIXME.
Double-click the entry to jump to the line with the pending task (see Figure 13).
25
© 2009 Sun Microsystems. All rights reserved.
This publication is protected by copyright. Please see page 2 for more details.
100 NetBeans
IDE Tips & Tricks
by Ruth Kusterer
FIGURE 13:
Task List window
Use the Show Tasks buttons to limit the search to one file, to extend it to all open projects, or to
include all dependent projects. If the list is very long, use the Filter button to constrain the list by type
or by custom keywords. Use the Toggle button at the bottom to Group Tasks by Category or to Display
Tasks as List. Right-click the list and choose Refresh from the context menu to update the view.
The Task List is a quick and intuitive way to keep track of current coding tasks. To make sure
special Task List features for Java are enabled, choose Tools > Options and select the Java
Code > Tasklist category. Check the box to enable detection of Java compiler errors and
@todo annotations.
To customize the list of keywords the list should include, choose Tools > Options and select the
Miscellaneous > ToDo Tasks category (see Figure14).
SECTION 3
Navigation
Tip Source
http://blogs.sun.com/roumen/entry/task_management_in_netbeans
26
© 2009 Sun Microsystems. All rights reserved.
This publication is protected by copyright. Please see page 2 for more details.
100 NetBeans
IDE Tips & Tricks
by Ruth Kusterer
FIGURE 14:
ToDo Tasks Options
window
Tip 18: Open a File in the Editor from the Command Line
Use the --open path:line command-line switch to open the specified file in the IDE’s Source Editor.
Specifying the line is optional. The following example opens the file
MarsRoverViewerApp.java
positions the caret in line 10:

Get Checkered Flag Projects: 10 Rules for Creating and Managing Projects That Win! Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.