NetBeans-material

Start here

  1. Registering for the course
  2. Installing NetBeans and the TMC-plugin
  3. Beginning to program with NetBeans

NetBeans-tips

Automaatic System.out.println

Type sout and press tab (the key to left of q), a System.out.println will appear automatically in the editor

Automatic indenting

Set the focus on the file in the editor window that you want to indent. Press alt, shift and f simultaneously. Alternatively you can select from the top bar menu Source and below that format.

more 'power user' tips will be added later

Auto completion of code

If you, for example, have a variable String lastName; in your program, you don't necessarily need to write the entire name of the variable every time. Try what happens when you type s and hit ctrl and space simultaneously. NOTE: on computers at the department the same is done by pressing ctrl, alt and space simultaneously. NetBeans can complete other names too in the same fashion, for example, to get a while-command you only need to type w and press ctrl+space...

Renaming

Variables, methods and classes should be named describingly. However often names get a little inaccurate and a need for renaming arises. In NetBeans this is very easy to do. Select the bad name by clicking it (so that the text cursor is somewhere in the name) and simultaneously press ctrl and r, then type in the new name for the method/variable. The name changes everywhere in the program!

Empty row below the current row

Press shift + enter and you'll get a new line, no matter where on the line your cursor is.

Generating constructors, getters and setters automatically

Go inside the code block of your class, but outside of it's methods. Press ctrl and space simultaneously; if your class has an object variable balance, for example, NetBeans gives you the option to generate getter and setter methods for that object variable, and a constructor - with which you can set the starting value of that object variable. NOTE: at the department we can achieve the same by pressing ctrl+alt+space.

Links to other NetBeans instructions