- Select the text to be commented.
- Press Alt+Enter. A drop-down menu will come. Select Surround with /*$selection*/
- Go to Tools -> Options.
- In Options select the Editor -> Macros tab.
- Now Click New. A pop-up will come. Enter the macro name Comment .
- A new entry in the macro table is entered. Select the entry and paste the following code in the Macro Code window.
- Set Shortcut Alt+Q (or anything you like)
select-identifier last-non-white remove-line cut-to-clipboard caret-begin-line paste-from-clipboard first-non-white remove-line remove-line
- Set shortcut Shift+Alt+Q (or anything you like)
- Click Ok.
Enjoy NetBeans :)