1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
* Copyright ļæ½ 2006 Sun Microsystems, Inc. All rights reserved.
4
* Use is subject to license terms.
9
<title>Source Editor Tips</title>
10
<link rel="stylesheet" href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/ide.css" type="text/css"></TITLE>
15
<h2>Source Editor Tips</h2>
17
<p>The following table shows how to accomplish some common tasks
18
and gives you some tips for working in the IDE's Source Editor.</p>
20
<table border="1" cellpadding="5" cellspacing="0" summary="The left column lists the
21
task name. The right column lists the steps to perform.">
23
<th scope="col" align="left">To perform this task</th>
24
<th scope="col" align="left">Follow these steps</th>
28
<td>Handle the automatic insertion of quotation marks, parentheses, and so on.</td>
31
<p>When you type a character that typically is used in pairs (such
32
as a quotation mark or a parenthesis, the IDE also automatically inserts
33
the closing character (such as another quotation mark or the
34
closing parenthesis). If you find this distracts your typing,
35
you can simply type the closing characters as you would normally.
36
The IDE will use the closing character that you type and delete the
37
character that it inserted.</p>
42
<td>Format code automatically with consistent indentation.</td>
45
<ul><li>Right-click in the Source Editor and choose Reformat Code.
46
<p>If any text is selected, only
47
that text will be reformatted. If no text is selected, then the whole file is reformatted.</p></li></ol>
52
<td>Find the appropriate code element (class, method, or field)
53
and insert it into your code.</td>
57
<li>When typing in the Source Editor, press Ctrl-Space to open
59
<a href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/editing/codecompletion/intro.html">code completion</a> box.</li>
61
<li>Scroll the list of code elements provided, select the one you
62
want, and press Enter. </li></ol>
67
<td>Insert a commonly used code snippet.</td>
71
<li>Type the abbreviation for the code snippet and press Shift-Space.</li>
73
<p>See <a href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/shortcuts/abbreviations-list.html">Code Template Abbreviations: Quick Reference</a>.</p>
77
<td>Quickly insert a word that you have already typed elsewhere.</td>
80
<li>Type the beginning character of the word that you have
81
previously typed.</li>
82
<li>Type Ctrl-K to insert the closest previous word that matches
83
those beginning characters.</li>
86
<p>For example, consider the following code:
87
<pre>BufferedReader br = new BufferedReader(<i>...</i>)</pre>
88
<p>You can save yourself several keystrokes by doing the following:
91
<pre>BufferedReader br = new B</pre></li>
93
<li>Press Ctrl-K to insert <tt>ufferedReader</tt>
97
<p>See <a href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/editing/wordmatch.html">Using the Word Match Feature</a>
98
for more information.</p>
102
<td>Go to the Java source for the identifier the insertion point is on.</td>
104
<ul><li>Press Alt-O, or choose
105
Navigate > Go to Source.
110
<td>Go to a Java file via hyperlinks.</td>
113
<li>Hold down the Ctrl key and, at the same time, move your mouse over and click a
114
Java identifier (package, class, method, variable).</li>
121
<td>Go to a Java class.</td>
123
<ul><li>Choose Edit > Go To Class or press Alt-Shift-O.
130
<td>Jump to the declaration for the Java method or field the insertion point is on.</td>
132
<ul><li>Press Alt-G, or right-click and choose
133
Go To > Declaration from
139
<td>Go to a specific method or field in the currently displayed Java class.</td>
142
<li>Double-click the method or field
143
in the Navigator window.</li>
149
<td>Jump back and forth among areas of code in which you
150
have been working.</td>
153
<li>Use the Alt-K and Alt-L <a href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/editing/jumplist.html">jump list</a>
154
keyboard shortcuts.</li>
159
<td>Bookmark a line of code.</td>
162
<li>Click anywhere in the line that you want to bookmark and press Ctrl-F2.
163
<p>Press F2 to cycle through your bookmarks.</p>
164
<p>Press Ctrl-F2 on a bookmarked line to remove the bookmark.</li>
170
<td>Maximize the Source Editor.</td>
172
<p>Do one of the following:</p>
174
<li>Double-click a file's tab in the Source Editor.
177
<li>Make sure that the Source Editor window has focus and then press Shift-Escape.</li>
178
<li>Choose Window > Maximize.</li>
182
<td>Revert a maximized Source Editor to its previous size.</td>
185
<p>Do one of the following:</p>
187
<li>Double-click a file's tab in the Source Editor.</li>
188
<li>Press Shift-Escape.</li>
189
<li>Choose Window > Restore.
196
<td>Display line numbers.</td>
198
> Show Line Numbers.
203
<td>View two files simultaneously.</td>
205
<ol><li>Open two or more files.</li>
206
<li>Click the tab of one of the files and drag it to the side of the window
207
where you want the file to be
208
placed. When a red preview box appears to show you where the window will be placed,
209
release the mouse button to drop the window.
210
<p>The window can be split horizontally or vertically, depending on where you drag
215
<td>Split the view of a single file.</td>
219
<li>Right-click the document's tab in the Source Editor and choose
222
<li>Click the tab of the cloned document and drag it to the part of the window
223
where you want the copy to be placed. </li></ol>
236
<small><a href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/credits.html">Legal Notices</a></small>