
SECTION 8
Time Savers
Time Savers
Tip 61: Code More Quickly with Automatic Code Completion
The IDE’s code completion feature assists you with writing code as you type. Code completion
works in Java, Javadoc, HTML, XML, and Ant files, among other file types. Here are some examples
of how to use this time saver:
. Create a new Java class and add instance variables. Place the caret after the instance variables
and press Ctrl-Space to call up the code completion dialog. The IDE will suggest to generate a
matching constructor. The generated constructor will contain an appropriate method signa-
ture and skeleton code to initialize the instance variables (see Figure 63).
103
© 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 63:
Generating a
constructor for
existing fields
. Ctrl-Space additionally calls up a Javadoc
pop up for the selected method. If the
method is polymorphic or overloaded, it
will show all sets of parameters that this
method accepts. Press Enter on a list item
to complete the selected method parame-
ters automatically. Press the Tab key to
jump from one parameter to the next
(see Figure 64).
Tip
If Ctrl-Space is already assigned to another action in your locale, use Ctrl-Backslash instead.