Bristle Software NetBeans Tips

This page is offered as a service of Bristle Software, Inc.  New tips are sent to an associated mailing list when they are posted here.  Please send comments, corrections, any tips you'd like to contribute, or requests to be added to the mailing list, to tips@bristle.com.

Table of Contents:

  1. NetBeans Shortcut Keys

Details of Tips:

  1. NetBeans Shortcut Keys

    Original Version: 3/2/2012
    Last Updated: 3/2/2012
    Applies to: NetBeans 7.1+

    Here is a list of some of the more useful shortcut keys in NetBeans.

    Notes:



    Key Function
    ?? Ctrl-Shift-L

    Show popup list of all currently applicable shortcut keys and key sequences.  

    Hit Ctrl-Shift-L again to see a dialog with the list of all defined keys/sequences and the contexts in which they apply, and to define new keys/sequences.  This list is very long, so sort by the Binding column if you are trying to look up a particular key.

       
    Click Highlight all occurrences of identifier in file
    Ctrl-Click Go to declaration of object at cursor (variable, class, etc.)

    Cmd-B

    Go to declaration of object at cursor (variable, class, etc.)

    Cmd-Shift-B

    Go to source code that implements object at cursor (variable, class, etc.)
    ?? F4 Go to type at cursor in class hierarchy window
    Cmd-O Selection dialog for types (classes, etc.), where you can type the beginning of the short name (w/o packages) and quickly go to the right source file.  Wildcards * (any sequence of chars) and ? (any single char) are supported.
    Nested tip: In this dialog box, you can type just the capitalized letters of your class name if you prefer.  For example, I can type FTI to get to my FileTreeIterator class.
    ?? Ctrl-F3 Selection dialog for members of the current class (methods, variables, etc.), where you can type the beginning of the name and quickly go to the right place in the source file.  Wildcards * (any sequence of chars) and ? (any single char) are supported.
    Thanks to Ken Smith for showing me this one!
    Ctrl-Shift-O Selection dialog for files (Java source files, config files, property files, etc.), where you can type the beginning of the short file name (w/o folder names) and quickly go to the right source file.  Wildcards * (any sequence of chars) and ? (any single char) are supported.
    Nested tip: In this dialog box, you can type just the capitalized letters of resource name if you prefer.  For example, I can type CBW to get to my CloseBrowserWindow.jsp file.
    ?? Ctrl-Shift-H Selection dialog to show a type in the class hierarchy window.  Like Ctrl-Shift-T, but shows class hierarchy instead of Java source.  Wildcards * (any sequence of chars) and ? (any single char) are supported.
    Nested tip: In this dialog box, you can type just the capitalized letters of your class name if you prefer.  For example, I can type FTI to get to my FileTreeIterator class. 
    ?? Ctrl-T Show Quick Class Hierarchy
       
    DblClick a tab Maximize/restore view/editor in that tab (toggle)
    Shift-Esc Maximize/restore current view/editor (toggle)
       
    Ctrl-Space
    Content Assist and Javadocs
    • Code completion, name completion, etc.
    • Does lots of useful completions in different contexts.  Try it!
    • When the cursor is among the methods of a class declaration, this pops up a list of parent methods that can be overridden, getters/setters that can be generated, etc.
    • After an open paren of a method call, this pops up the parameter list.
    • When on an unrecognized class name, this suggests import statements to add, based on the available classes and JAR files.
    • Shows Javadocs also in a 2nd window.
    Cmd-\
    ?? Ctrl-Shift-Space Parameter Hints
    ?? Ctrl-1 Quick Fix (after finding compiler error, easy way to add imports, correct spelling errors, etc.)
    ?? Ctrl-2 Quick Assist (fast renaming, etc.)
    ?? Ctrl-3 Quick Access (fast way to find an editor command)
    Cmd-I Quick Search (fast way to find an editor command, Java package, etc.)
       
    Cmd-Z Undo
    Cmd-Shift-Y Redo
    Cmd-Y
    ?? Alt-Shift-Z Undo refactoring operation
    ?? Alt-Shift-Y Redo refactoring operation
       
    ?? Ctrl-O Show current context (method, class, package, etc.), and allow quick navigation to other methods, members, inherited methods, etc.
    Cmd-F12 Show members of class and allow quick navigation to other methods, members, inherited methods, etc.
    ?? Ctrl-G Show context of identifier at cursor (method, class, package, etc.)
       

    ?? Alt-Left

    Go back (through recent editing locations)
    ?? Cmd-[
    ?? Opt-Cmd-Left

    ?? Alt-Right

    Go forward (through recent editing locations)
    ?? Cmd-]
    ?? Opt-Cmd-Right
    Ctrl-Q Go to most recently edited location
       
    Ctrl-F4 Close editor window
    Cmd-W
    ?? Ctrl-PageDn Go to next editor window in current tab set

    ?? Ctrl-Fn-Down

    ?? Ctrl-PageUp Go to previous editor window in current tab set

    ?? Ctrl-Fn-Up

    ?? Ctrl-E Switch to another editor in current tab set.  Can type a name here.
    ?? Ctrl-F6 Go to next editor (shows list and toggles between 2 most recent)
    ?? Ctrl-F7 Go to next view (shows list and toggles between 2 most recent)
    ?? Ctrl-F8 Go to next perspective (shows list and toggles between 2 most recent)
       
    Cmd-Shift-1 Go to current source file in Projects tree
    Cmd-Shift-2 Go to current source file in Files tree
       
    Cmd-Shift-M Toggle Bookmark
    Cmd-Shift-Period Go to next bookmark
    Cmd-Shift-Comma Go to previous bookmark
       
    Cmd-[ Go to matching bracket
    ?? Ctrl-Shift-Down
    Go to next object (method, variable, class, etc.) in source file.
    ?? Ctrl-Opt-Down
    ?? Ctrl-Shift-Up
    Go to previous object (method, variable, class, etc.) in source file.
    ?? Ctrl-Opt-Up
    Ctrl-G Go to line number
       
    Cmd-F Search within a file
    Cmd-R Search and replace within a file
    Ctrl-H
    Ctrl-Opt-G Search for word at cursor
    Cmd-G Search Next within a file
    Cmd-Shift-G Search Previous within a file
    Ctrl-F7 Find all usages in file, package, project, all projects, etc.
    Cmd-Shift-F Find all occurrences in files, project, open projects, etc.
    Cmd-Shift-H Find and replace all occurrences in files, project, open projects, etc.
    ?? Ctrl-H Search in project, workspace, file system, etc.
    Also offers Java-sensitive searches, limiting matches to:
    • Declarations of objects
    • References to objects
    • Implementors of interfaces
    • Reads of variables
    • Writes of variables
    ?? Ctrl-J Incremental Search forward
    ?? Ctrl-Shift-J Incremental Search back
    ?? Ctrl-Period
    Search Next, also Next Error, Next Diff (only in the views for search, problems, compare, etc.)
    ?? Ctrl-Comma Search Previous, also Previous Error, Previous Diff (only in the views for search, problems, compare, etc.)
    ?? Ctrl-Shift-U When an identifier is selected: Find all occurrences of identifier in the file (showing them in Search pane)
    When a class or interface name that follows one of the keyword "extends" or "implements" is selected: Find all methods in the file that implement methods defined in the class or interface (showing them in Search pane)
    ?? Ctrl-Alt-G Find all occurrences of selected text in workspace (showing them in Search pane)
    ?? Ctrl-Shift-G Find all references to selected identifier in workspace (showing them in Search pane)
    ?? Ctrl-Alt-H Show call hierarchy
       
    Cmd-Slash Toggle Comment
       
    Tab Indent
    Shift-Tab Undent
       
    F6 Run (may have to click on project name first)
    Cmd-Shift-F6 Debug (may have to click on project name first)
    F7 Step Into
    F8 Step Over
    Cmd-F7 Step Out
    F5 Resume
    Ctrl-Up/Down Move up/down the call stack
       
    ?? Alt-Shift-W Show in another view (chosen from popup)
       
    ?? Alt-Shift-Arrows Expand/contract selection syntactically (variable ==> expression ==> statement ==> block ==> method ==> class ==> file)
       
    Ctrl-R Rename item (method, field, variable, parameter, type, compilation unit, package, source folder, project)
       
    Cmd-U, U To upper case
    Cmd-U, L To lower case
    Cmd-U, S Toggle case
       

    Cmd-Shift-U

    Create JUnit Test

    Cmd-Shift-T

    Goto JUnit Test

    Ctrl-F6

    Run JUnit Test
    Cmd-F6

    This list is far from complete.  Please feel free to mail me your favorite shortcuts.  I'll add to this list as time permits.

    For more, see Help | Keyboard Shortcuts Card.

    For the complete lists, and to define your own, and to switch to a different set (Emacs, Eclipse, IntelliJ, etc.), see Tools | Options | Keymap.

    --Fred

©Copyright 2011-2014, Bristle Software, Inc.  All rights reserved