Sunday, May 31, 2015

Add Code Short Cut on NetBeans IDE

For a long time, I have been using JDeveloper to develop Java Web Applications. One convenient thing i like about JDeveloper is a short cut code for typing syntax. For instance, when I do debug, I simply type "sop" (with no double quote) then press Ctrl + Enter simultaneously, and the code automatically spell "System.out.println();" (with no double quote again). For my latest project, I used NetBeans IDE 8.0.1 since it is very convenient for creating GUI Desktop APIs. But then, the shortcoding of System.out.println is "sout". I always unconsciously type "sop" for SysOut short cut and it somehow annoys me that the Netbeans did not spell it out. So though, I made a custom short code short cut to make "sop"  spell out after I pressed Enter. So here is what I did:

1. Open your NetBeans. I am using version 8.0.1.
2. Go to your Tools menu then click Options.


3. Options menu will appear. Check on the templates if the abbreviations you will use already exists in the list. If not, click New button. 

4. New Code Template window will appear. Type your abbreviation on the text box. Click OK to continue.

5. The abbreviation added will be seen on the templates list. Click the row of your abbreviation. On the tabs below, type your corresponding code of your abbreviation on the Expanded Text tab (e.g System.out.println();). On the Expand Template on dropdown list, select the key to where your code spelling out will trigger. I chose Enter key. Click Apply button to save.


6. Voila! Try on your short code and press the key/s you designated to on when to expand.

I've read in one Quora forum that a sign that a programmer is abreast to the rest of his colleague when he/she has already mastered how to use the IDE he is working on.

I hope that this helps! Freely share your IDE tricks to make your programming life easier.



No comments:

Post a Comment