Salient Features of Netbeans 6.0 Beta
These are the most interesting features I found when i used Netbeans 6.0 Beta for the first time.
Hope you’ll enjoy them too :)
1. If you want to type something in the beginning of a statement/line, you can just press ctrl+space, or several first characters first, and Netbeans will pops up all the possible words for you. And if you choose some Object whose packages is not already imported, Netbeans will automatically adds the required packages for you.
2. Don’t bother typing import statements, just wait till it shows the red box with cross in the left side of the editor. Put your cursor in that line, and a lightbulb will show. Press alt+enter to display the proposed actions, click on it. And you’ll get your import statements automatically.
3. When you are typing a method, the moment you type in the opening brackets for method arguments, Netbeans will automatically add the closing brackets (default setting). If you type in your own closing bracket, it’ll overwrite the previously added closing brackets. To have the ending semicolon, you don’t have to move one position after the closing bracket, just directly type in the semicolon, Netbeans will put it at the end of the line. Also if you have a String literal as the arguments, Netbeans will automatically add the closing double-quote the same fashion with the brackets. In this case, you do need to put your cursor after the closing quote before you type in the semicolon.
4. Don’t bother to type the try-catch statements. Just code the expressions, select it, right click, select surround with try catch. Or wait untill it shows warning, you can choose either to enclose them in a try-catch block or just to add a throw clause in the method signature. But if you really want to have the try-catch block in the beginning, okay, you can type try and then press ctrl+space and enter. You’ll have a try-catch block and your cursor will be on the ‘Exception’ which you can change directly to any specific Exception you want.
5. When you want to implement an interface or extend a class, you can just type ‘im’ or ‘ex’ and then Space, and Netbeans will type in the complete word for you.
6. When you implements an interface, you’ll initially have an error warning for unimplemented interface methods. Just put your cursor on the method declaration line, and the lightbulb will show. Press Alt+Enter or click on the bulb, and then click on the menu for implementing those methods. Netbeans will put all the methods you need to implement for you.
7. If you a have a block of code with messed up indentation, just block the code using your mouse, right click, and selet reformat code. Netbeans will tidy up your code indentation.
8. In a method definition body, when you want to use a member field, you don’t have to manually declare the field first. Just type in the name of the field as if it was already declared. When the warning shows, press alt+enter and select option to create member fields. Or if you just want to have a local variable, there’s also an option for that in the lightbulb’s proposed actions.
9. If you want to rename something, Class name, method name, variable name, or whatever, don’t do ReplaceAll. Use Refactoring! Just select the name, right click, select Refactor > Rename.
10. If your class still has errors, you’ll know even before compiling because Netbeans will mark the line with a red box with an ‘x’ sign. Also, each class editor page will have a box in the upper right corner. If it is red, then you still have errors, if it’s green, then your class is OK. If it is still has errors, you can see several red bars in the right of the page, click those to go the problem line.
11. Last but not least you need not to remember all the shortcuts. They all are segregated at one place. Just click on Help > Keyboard Shortcuts Card. It will automatically link to your pdf file reader and if it is not linked, Netbeans 6.0 Beta will ask you to link it with your pdf reader.
Also, did you know that Netbeans was initially a student project named Xelfi at Charless Univ in Prague? The name Netbeans came from the idea of creating Network-ready JavaBeans. After acquired by Sun, it was called Forte for Java, but now it is Netbeans as we love it.