Format Source

I guess I should have realised that starting a new blog on the 13th (even though it was not a Friday), might be a bad idea. πŸ™‚ Soon after the first post I experienced technical difficulties with the server. Today I finally got around to setting everything up again, so here is the first real post. πŸ™‚

One of my favourite features of the NetBeans IDE is source formatting. With the press of a few buttons (Alt + Shift + F) (or Source | Format from the menu bar), you can convert a real mess…

[java]package javaapplication1;public class JavaApplication1 {/*** @param args the command line arguments*/public static void main(String[] args) {System.out.println(“Hallo World!”);}}[/java]

into something a lot more readable…

[java]package javaapplication1;

public class JavaApplication1 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println(“Hallo World!”);
}
}[/java]

The format is highly configurable, to suit the preferences of all developers. The settings can be accessed from Tools | Options, in the Editor category on the formatting tab.

Source formatting is not limited to Java source code though – it works equally well for XML. For example, from

[xml][/xml]

to

[xml]






[/xml]

Instructional designer, educational technologist and occasional lecturer who loves travel and photography

Leave a Comment