Tuesday, January 13, 2009

Suggestions in NetBeans

NetBeans 6.5, just like some earlier versions, has a nice feature that points out low level suggestions, tips or hints, showing a differently colored bulb on the left of your code, just before the line numbers (if you use them), e.g. if you override a method in a subclass the IDE suggests to add the @Override Annotation, or if you invoke a method that could throw an exception the IDE provides you with the choice to declare that it throws the exception or to surround the statement (or the whole block) with a try/catch block.

Until this afternoon I clicked the bulb and selected the appropriate choice, each and every time blaming the disconnect/reconnect pattern between keyboard and hands that everyone hates so much. I won't say mice are for losers, but once you're using the keyboard you should stick to it. Ever heard of how context switching makes you lose time? It holds true for your hands as well.

Then I was feeling something was in the air, and I had a revelation. Why didn't I seek the NetBeans shortcut card (Help - Keyboard Shortcuts Card)? And so I did, and even if the search was fruitless it laid the seed: my answer was peacefully waiting for me in the complete keyboard shortcuts specification.

Now, a happier and wiser man, whenever I spot that bulb I just hit

ALT + Enter

and there you have it... Isn't it wonderful? Now I'm going to glance over the list and find out more (not so) hidden treasures... oh by the way try to expand the newo template :-)

No comments: