Editor Shortcuts

See Also

There are keyboard shortcuts available to activate the following Source Editor operations:

Scrolling and Selecting

Keys Action
Alt-U, T Scrolls the line the instertion point is on to the top of window.
Alt-U, M Scrolls the line the instertion point is on to the middle of window.
Alt-U, B Scrolls the line the instertion point is on to the to bottom of window.
Ctrl-down arrow Scrolls the window up without moving the insertion point.
Ctrl-up arrow Scrolls the window down without moving the insertion point.
Ctrl-[ Moves the insertion point to the highlighted matching bracket. This shortcut only works when the instertion point is immediately after the opening or closing bracket.
Ctrl-Shift-[ Selects the block between a pair of brackets. This shortcut only works when the insertion point is imtmediately after either the opening or closing bracket.
Ctrl-G Jumps to any specified line.
Alt-Shift-T Moves the insertion point to the top of the window.
Alt-Shift-M Moves the insertion point to the middle of the window.
Alt-Shift-B Moves the insertion point to the bottom of the window.
Ctrl-Home Moves the insertion point to the beginning of the document.
Ctrl-End Moves the insertion point to the end of the document.
Alt-Shift-S In Java classes, selects the current syntactic element. With successive pressings, the containing element is selected. For example, if the insertion point is in a statement, the statement is selected with the first pressing. On the second pressing, the method is selected. On the third pressing, the class is selected.
Alt-Shift-A Used with Alt-Shift-S, reverts the selection back one step. For example, if you have pressed Alt-Shift-S several times to select a class, you could press Alt-Shift-A to reduce the selection to the method where the insertion point is.
Ctrl-A Selects all text in the file.

Modifying Text

Keys Action
INSERT Switches between insert text and overwrite text mode.
Ctrl-Shift-J Opens the Internationalize dialog box that you can use to insert an internationalized string at the insertion point.
Alt-U, U Makes the selected characters or the character to the right of the insertion point uppercase.
Alt-U, L Makes the selected characters or the character to the right of the insertion point lowercase.
Alt-U, R Reverses the case of the selected characters or the character to the right of the insertion point.

Code Folding

Keys Action
Ctrl-Minus (-) Collapses the block of code the instertion point is on.
Ctrl-Plus (+) Expands the block of code the instertion point is next to.
Ctrl-Shift-Minus (-) Collapses all blocks of code.
Ctrl-Shift-Plus (+) Expands all blocks of code.

Recording Macros

Keys Action
Ctrl-J, S Begins recording key sequence for macro.
Ctrl-J, E Stops recording key sequence for macro.

Cutting, Copying, Pasting, and Deleting Text

Keys Action
Ctrl-Z (Undo) Reverses (one at a time) a series of editor actions, except Save.
Ctrl-Y (Redo) Reverses (one at a time) a series of Undo commands.
Ctrl-X (Cut) Deletes the current selection and places it on the clipboard.
Shift-Delete (Cut) Deletes the current selection and places it on the clipboard.
Ctrl-C (Copy) Copies the current selection to the clipboard.
Ctrl-Insert (Copy) Copies the current selection to the clipboard.
Ctrl-V (Paste) Pastes the contents of the clipbard at the insert point.
Delete (Delete) Deletes the current selection.
Ctrl-E Deletes the current line.
Ctrl-U Deletes text in the following sequence:
  • text preceding insertion point on same line
  • indentation on same line
  • line break
  • text on previous line
Ctrl-Backspace Removes the text in the current word preceding the insertion point.
Ctrl-K Copies the word preceding the insertion point and pastes it at the insertion point. (The insertion point must be on a whitespace before or after a word.) Press K multiple times to cycle through consecutive previous words.
Ctrl-L Copies the word following the insertion point and pastes it at the insertion point. (The insertion point must be on a whitespace before or after a word.) Press L multiple times to cycle through consecutive following words.

Searching for Text

Keys Action
Ctrl-F3 Searches for the word the insertion point is on and higlights all occurrences of that word.
F3 Selects the next occurrence of the word in your current search.
Shift-F3 Selects the previous occurrence of the word in your current search.
Alt-Shift-H Switches highlighting of search results on or off.
Ctrl-F Opens the Find dialog box.
Ctrl-H Opens the Find and Replace dialog box.

Setting Tabs

Keys Action
Tab Shifts all text to right of insertion point to the right.
Ctrl-T Shifts text in line containing the insertion point to the right.
Ctrl-D Shifts text in line containing the insertion point to the left.

Modifying Code

Keys Action
Ctrl-Spacebar Opens the Java code completion dialog box.
Alt-Enter Display editor hints for Java files. The IDE informs you when a hint is available when the lightbulb (lightbulb icon ) icon is displayed.
Ctrl-\ Opens the Java code completion dialog box.
Shift-Enter Enters the text that is selected in the code completion box into your file.
Alt-Shift-F Generates missing import statements and removes unused import statements for the current class.
Alt-Shift-I Adds an import statement to the import section of the code when cursor is over the class name to be imported.
Alt-U, G Appends the prefix get to the identifier.
Alt-U, S Appends the prefix set to the identifier.
Alt-U, I Appends the prefix is to the identifier.
Alt-G Goes to the method or variable declaration for method or variable the insertion point is on.
Ctrl-M Selects the next parameter. You must have a parameter selected (highlighted) for this shortcut to work.
Ctrl-Shift-T Comments out the current line or selected lines.
Ctrl-Shift-D Removes comment from the current line or selected lines.
Alt-K Goes to the previous entry in the jump list. This The jump list is a list of locations in your files where you have been working.
Alt-L Goes to the next entry in the jump list. This shortcut is related to the Alt-K shortcut and only works if you have just used Alt-K or Alt-Shift-K.
Alt-Shift-K Goes to the previous entry in jump list not in the same file. The jump list is a list of locations in your files where you have been working.
Alt-Shift-L Goes to the next entry in jump list not in the same file. This shortcut is related to the Alt-Shift-K shortcut and only works if you have just used Alt-K or Alt-Shift-K.
Ctrl-Shift-F Reformats selected code or entire file if nothing is selected.
Shift-F10 Opens editor's contextual menu.
Ctrl-J, D A macro that selects the identifier that the insertion point is in and then inserts debugging code on the previous line to print the value of that identifier.
Shift-Spacebar Adds a space without checking for code templates that can be created from the previous word.

Opening Files

Keys Action
Alt-O Opens the source of the identifier that the insertion point is on.
Alt-Shift-O Opens a dialog box in which you can search for the source code for any element of Java source.
Ctrl-B Opens the source of the base method that the current method implements or overrides.
Alt-F1 Opens the web browser on the Javadoc file pertaining to the item that the insertion point is on. For this shortcut to work, the compiled Javadoc documentation has to be available to the project. You can add Javadoc for the JDK in the Java Platform Manager window. You can add Javadoc documentation for other libraries through the Library Manager window.

Using Bookmarks

Keys Action
Ctrl-F2 Sets or unsets a bookmark at current line.
F2 Goes to next bookmark.

Cycling Through Annotations

Keys Action
Ctrl-Shift-C Cycles through the annotations for the selected line.
See Also
Setting Keyboard Shortcuts
Menu Shortcuts
Help Viewer Shortcuts
Window Navigation Shortcuts

Legal Notices