Netbeans 6.1 Editor - One Of My Favorite Shortcuts / "Hidden" Functionalities
Netbeans 6.1 is able to automatically assign a return value and create a variable for you. This is really convenient. To try it out do the following:
- Type e.g. new java.util.Date(); (or new Date() with strg+space -> it will import it for you), or invoke an arbitrary method with a return value (e.g toString()).
- Then go with the cursor to Date() (or the method).
- You should see a yellow bulb on the left. Either click on the bulb, or click alt+enter.
- Netbeans should suggest you: "Assign Return Value To New Variable" just press Enter.
- Netbeans will create a variable, derive the name and the type. The end result is: Date date = new Date();
Just for comparison: In Eclipse press CTRL-1 and select "Assign statement to new local variable" or just CTRL-2 + L
Posted by svenmeier on July 02, 2008 at 05:57 PM CEST #
Hi Sven,
I actually don't know the key binding for this functionality in NB. CTRL-1 in Eclipse is Alt+Enter in Netbeans. Thank you for the hint!
adam
Posted by Adam Bien on July 02, 2008 at 06:22 PM CEST #
Hallo,
ok, NetBeans is working hard to catch up with Eclipse :)
Is there already easy navigation through element occurances within hierarchy? (Ctrl+T)
Can NetBeans search for places where e.g. value is assigned to particular variable? (Configurable search after Ctrl+H)?
regards
adg
Posted by 77.236.1.117 on July 03, 2008 at 12:08 AM CEST #