In this article, we will learn about how to use shortcut keys in Netbeans. Let’s get started.

Table of contents

Operations with lines

Shortcut keys Definition
Ctr + E or Shift + Delete Delete the current line
Ctrl + Delete Delete the next word after the cursor
Ctrl + Backspace Delete the previous word before the cursor
Alt + Shift + Up Move up the current line
Alt + Shift + Down Move down the current line
Ctrl + Shift + Up Copy and move up the current line
Ctrl + Shift + Down Copy and move down the current line
Shift + Enter Insert a blank line below the current line
Ctrl + Enter Insert a blank line above the current line

Operations with source code

Shortcut keys Definition
Ctrl + Shift + I Organizes import statements by removing unused imports and adding missing ones
Alt + Shift + F Format a selected block
Ctrl + Shift + C or Ctrl + / Toggle comment for the current line or a selected block of code
Alt + Insert Show context menu to generate code
Alt + Shift + F Format selection (Indent)
Ctrl + Shift + R Rectangle selection (toggle)
Ctrl + R Rename

Operations with Window

Shortcut keys Definition
Ctrl + F12 Inspect members of a class
Alt + F12 Inspect hierarchy of a class
Ctrl + Shift + Enter Toggle maximum/minimum of the current editor
Ctrl + Tab or Ctrl + ` Switch between open documents by order used

Search operations

Shortcut keys Definition
Ctrl + F3 Search word at insert point
F3 or Shift + F3 Find next/previous in file
Ctrl + F or Ctrl + H Find or Replace in file
Ctrl + Shift + F or Ctrl + Shift + H Find or Replace in project
Alt + F7 Find usages
Ctrl + O or Alt + Shift + O Go to type/file
Alt + Up or Alt + Down Next/previous marked occurrence
Alt + Shift + L Copy file path

Run, debug source code

Shortcut keys Definition
F11 Build main project
Shift + F11 Clean and build main project
Ctrl + Q Set request parameters
Ctrl + Shift + U Create Unit test
Ctrl+ F6/Alt + F6 Run Unit test on file/project
F6/Shift + F6 Run main project/file
Ctrl + F5 Start debugging main project
Ctrl + Shift + F5 Start debugging current file
Ctrl + Shift + F6 Start debugging test for file
Shift + F5/F5 Stop/Continue debugging session
F4 Run to cursor location in file
F7/F8 Step into/over
Ctrl + F7 Step out
Ctrl + Alt + Up Go to called method
Ctrl + Alt + Down Go to calling method
Ctrl + F9 Evaluate expression
Ctrl + F8 Toggle breakpoint
Ctrl + Shift + F8 New breakpoint
Ctrl + Shift + F7 New watch

Shortcut keys

  1. With data type

    Shortcut keys Definition
    En Enumeration
    bo boolean
    St String
    Ex Exception
    db double
    fl float
    fa false
    sh short
    vo volatile
    iof instance of
    fi final
  2. With control statements

    Shortcut keys Definition
    br break
    cn continue
    df default
    wh while
    th throws
    fy finally
    tw throw
  3. With class

    Shortcut keys Definition
    cl class
    ab abstract
    ex extends
    pu public
    pr private
    pe protected
    im implements
    ie interface
  4. With methods

    Shortcut keys Definition
    psvm public static void main
    Psf public static final
    Psfb public static final boolean
    Psfi public static final int
    Psfs public static final String
    as assert true
    ca catch
    eq equal
    psf private static final
    psfb private static final boolean
    psfi private static fianl int
    psfs private static final String
    pst printStackTrace()
    le length
    sout System.out.println()
    soutv System.out.println(“obj”+obj)
    ir import
    bcom /**/

Wrapping up

  • We should use shorcut keys to improve typing code in Netbeans.