In most cases, working with the IDE on the Mac
is no different from working on other operating systems.
Two significant differences do exist, however. Firstly,
the Options window on the Mac is found under
NetBeans > Preferences, while the About box
is under NetBeans > About.
Secondly, some keyboard
shortcuts on the Mac are different. Below are tables
displaying the main keyboard shortcuts and how to
use them on the Mac. For a complete list of keyboard
shortcuts, including those on the Mac, see the
complete keyboard shortcut list, which is found here:
Scrolling and Selecting
Keys
Action
Cmd-[
Moves the insertion point to the highlighted matching bracket. Note that
this shortcut only works when the insertion point is located immediately
after the opening bracket.
Cmd-Shift-[
Selects the block between a pair of brackets. Note that this shortcut
only works when the insertion point is located immediately after either
the opening or closing bracket.
Ctrl-G
Jumps to any specified line.
Cmd-A
Selects all text in the file.
Code Folding
Keys
Action
Cmd-Minus (-)
Collapses the block of code in which the insertion point is currently
located.
Cmd-Plus (+)
Expands the block of code which is adjacent to the insertion point.
Cmd-Shift-Minus (-)
Collapses all blocks of code in the current file.
Cmd-Shift-Plus (+)
Expands all blocks of code in the current file.
Cutting, Copying,
Pasting, and Deleting Text
Keys
Action
Cmd-Z
Undo. Reverses a series of editor actions one at a time
(excluding Save).
Cmd-Y
Redo. Reverses a series of Undo commands one at a time.
Cmd-X
Cut. Deletes the current selection and places it on the
clipboard.
Cmd-C
Copy. Copies the current selection to the clipboard.
Cmd-V
Paste. Pastes the contents of the clipbard at the insert
point.
Backspace
Delete. Deletes the current selection.
Cmd-E
Deletes the current line.
Cmd-K
Copies the word preceding the insertion point and then pastes
it after the insertion point (the insertion point must be in the whitespace
preceeding or following a word). Press K multiple times to cycle through
preceding words in succession.
Cmd-Shift-K
Copies the word following the insertion point and pastes
it at the insertion point (the insertion point must be located in the whitespace
preceeding or following a word.) Press L multiple times to cycle through
consecutive following words.
Searching for Text
Keys
Action
Cmd-G
Selects the next occurrence of the word found during
the search.
Cmd-Shift-G
Selects the previous occurrence of the word found during
the search.
Cmd-F
Opens the Find box at bottom of editor.
Cmd-R
Opens the Find and Replace dialog box.
Setting Tabs
Keys
Action
Tab
Shifts all text to the right of the insertion point one
tab stop to the right.
Cmd-Right arrow
Shifts text in the line containing the insertion point to
the right one tab stop.
Cmd-Left arrow
Shifts text in the line containing the insertion point to
the left one tab stop.
Modifying Code
Keys
Action
Ctrl-Spacebar
Opens the Java code completion dialog box.
Shift-Enter
Enters the text that is selected in the code completion box into your file.
Ctrl-I
Opens the Insert Code pop-up menu where you can choose from code snippets you want the IDE to insert.
Ctrl-Shift-I
Adds an import statement to the import section of the code when the cursor
is over the class name to be imported.
Ctrl-K
Goes to the previous entry in jump list.
Ctrl-Shift-K
Goes to the next entry in jump list.
Ctrl-J then D
A macro that selects the identifier under the caret. Then inserts debugging
code on the previous line to print the value of that identifier.
Shift-Spacebar
Adds a space without checking for abbreviations to expand.
Cmd-Shift-J
Opens the Internationalize dialog box that you can use to insert an localized
string at the insertion point.