is a cool Java integrated development environment
packed with lots of features along with the capability of extending its functions by adding more plugins. However, there are some of the tools or features in the IDE we rarely use while coding our Java program. This article will provide some tips and tricks for getting more productive on Netbeans. By doing a task more efficiently and getting more from the IDE when in doubt before turning in to the search engines.
Tab expansion is one of the fastest ways to get your program running in a short period of time. This feature lets you type less and let Netbeans do the hard work for you just by pressing the TAB key.
So instead of typing that long System.out.println(::) statement, here is how you can autocomplete that code statement using tab expansion. Type in sout and press TAB key to see the output sout turn to System.out.println(“”);
There are many trigger words or letters for expanding them to full statement or code blocks. For instance, try with the for statement, that is, type for then press TAB key and notice the output.
Code completion is another way to get your program running in a short period of time. What we can do with C in simple statements (like printf ) is quite a bit lengthy process for the same Java programs.
Code completion is useful when we don’t have a clue to complete our preferred lengthy statement using the above tab expansion feature. Moreover, the code completion feature automatically starts working the moment you code. All you have to do is press ENTER key when your preferred statement turns up in the top/first list.And in case, code completion isn’t working, press CTRL+SPACE to invoke it.
Netbeans has a cool way to let you get more familiar with its own and other developers code through references. If you have a doubt about a certain method or function, you hover over that method name while holding down CTRL key to read short descriptive info about it. That way you don’t have to browse the Internet and waste time searching for information about it.
We usually have the habit of using cut & paste feature for moving lines up and down. The more efficient approach for doing the same task is by transposing our lines of code using ALT+SHIFT+UP and ALT+SHIFT+DOWN arrow keys.
Using the above shortcut keys does not take into consideration the program’s scope. That is the code statement can even be moved up/down outside its method. If you want your code to be moved up and down within the method scope only then use PG UP and PG DN keys instead (along with ALT+SHIFT).
Refactor instead of replace
Find and Replace is another dangerous tool if you are working on a large project because you run the risk of changing codes (including those Java reserved ones) you didn’t even intend to or mess up documentation comments. Instead, use refactor to intelligently modify/update your code eliminating bad side effects.
Double click your variable or method name and select Refactor>Rename.
Try to select one Java reserved keyword and Refactor>Rename it, Netbeans would complain. How thoughtful, right? ;P
Lastly, there is a concern for space management on Netbeans IDE’s editor window.; it’s small.If you love spacious workspace at home and prefers the same on your computers, then Netbeans editor has two ways to let you enjoy coding by occupying the maximum screen on your display.
- By clicking on the maximize window icon for the editor window
- Using CTRL+SHIFT+ENTER key.
I love the second option because I can get the feel of working on a simple text editor program but with just more capability.
There are many more ways to get productive on Netbeans, however, the above are some of them I use on a daily basis. Hope you loved reading this article. Don’t forget to share it with your buddies who can benefit a lot from this. And please do let me know your thoughts and opinions in the comment section below.