Technical Hints

Learn how to use the tools available to you. The NetBeans IDE for example, has a multitude of useful features and shortcuts.

Are you constantly typing out the same code? Why not set up a code template for it? 

1: To do this, click on the Tools menu -> Options -> Editor -> Code Templates. You should see a table with three columns; Abbreviation, Expanded Text and Description. 

2: The Abbreviation column contains a short "template", the Expanded Text column contains the text represented by the abbreviation and the description column contains an optional description for the template.  

3: As an example, we will create a template which will create a String containing your name. Start by clicking on the "New" button. A dialog box will pop up. Type the following into the dialog box: mn (We use this to abbreviate "My Name") Click on the Ok button on the dialog. The dialog will disappear, and the focus will move to the large text area below the table. 

4: Type the following text into the text area: String name = "[Type your name here]"; Click the Ok button at the bottom of the form. 

5: Create a new Java class and type "mn" into the main method, then press the tab key. NetBeans will replace "mn" with the expanded text that you entered into your code template.  

By creating templates, you can save time and effort by typing out two or three characters to write an entire line of code. 

NetBeans has a number of built in templates. Among others, these include the following: 

En : Enumeration 

St : String 

ab : abstract 

cl : class 

df : default 

There a number of other templates available as well. You can view these by clicking on Tools -> Options -> Editor -> Code Templates.