NetBeans Cheetsheet

This is a list of some facilities the current NetBeans editor offers, that help me reduce the number of keystrokes I have to do when typing code. Basically it consists of my favorite abbreviations that generate code from templates, plus some shortcuts to commands and actions available in the source editor. Some of these abbreviations and shortcuts are ubiquitous in contemporary java IDEs and some are specific to NetBeans.

These type of tools along with some macros that suit your specific needs (either from within NetBeans or from an external macro utility), can speedup the task of getting the stuff from your head to the computer. Usually I have a bunch of cheetsheets printed on small pieces of paper and pinned on the frame of my monitor so there are available whenever I need them with out having to loose focus from the window I’m working on.

Abbreviations

dowhile do {} while (condition);
forc for (Iterator it = collection.iterator(); it.hasNext();) {Object elem = (Object) it.next();
ifelse if (condition) {} else {}
sout System.out.println(“|”)
trycatch try {} catch (Exception e) {}
!cd <![CDATA[|]]>

Shortcuts

Ctrl-G Jumps to any specified line.
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-E Deletes the current line.
Ctrl-Shift-T Comments out the current line or selected lines.
Ctrl-Shift-D Removes comment from the current line or selected lines.
Ctrl-F2 Sets or unsets a bookmark at current line.
F2 Goes to next bookmark.

Social Bookmarks:

Advertisements

2 thoughts on “NetBeans Cheetsheet

  1. I use netbeans shortcuts 1000 times per day.
    My favourite abbreviations are:
    pr
    st
    fi
    bo
    St
    forc
    fori
    psvm

    And my favourite shortcuts are:
    alt+shift+e (jumps from class to unit test and vice versa)
    ctrl+shift+u (creates unit test for class)
    ctrl+shift+1 (takes me to project nav with file selected)
    ctrl+f3 (marks current word and searches)
    and of course: alt+shift+o (goes to class)

    I can’t wait for NetBeans 6 GA.

  2. Pingback: What happened during the “Enterprise Java Tech Day” event in Athens « thoughts.iterator()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s