Netbeans Shortcut For Mac

Details
Written by Nam Ha Minh
Last Updated on 16 February 2020 | Print Email
Today I’m going to share with you some shortcut keys for refactoring Java code in NetBeans IDE. Use these shortcuts to boost your coding productivity.

1. Alt + Enter:

  1. H - TableShiftCtrlAlt JLF X Ctrl + HReplace Netbeans X Ctrl + HReplace Netbeans - editorX X Alt + Shift + H Toggle highlight search. Netbeans Menu Windows SolarisCDE KDE X Ctrl + H Same as back space.
  2. 10 NetBeans Shortcut Keys for Code Refactoring Alt + Enter: When the cursor is at the line marked as erroneous or problematic, press this shortcut will show up the suggestions (hints) to fix the error/problem: Ctrl + R: Alt + Delete: Ctrl + M: Alt + Shift + M: Alt + Shift + V: Alt + Shift + C: Alt + Shift + P.
  3. Optional: You can assign a shortcut to your custom target in NetBeans. Open the Files window in NetBeans (pc: ctrl-2, mac: command-2) Open your project's file tree so you see the build.xml file Click the triangle next to build.xml to list all targets. Right-click dist-zip and choose Create Shortcut from the context menu.
  4. Apache NetBeans Bugzilla – Bug 118222 60cat Insert Code Shortcut not Displayed in Top Level Source Menu on Mac Last modified: 2008-03-01 21:21:35 UTC.
When the cursor is at the line marked as erroneous or problematic, press this shortcut will show up the suggestions (hints) to fix the error/problem:This shortcut is very useful as it allows you to quickly access the options without moving the mouse to the line number column on the left and then click the hint icon.

Jan 12, 2018 Questions: Is there a shortcut in NetBeans to highlight a block of code and comment/uncomment it? Answers: The list of keyboard shortcuts can be found in the NetBeans Wiki. Turn On/Off Search Result highlights Alt + Shift + H Add/remove comment. Should work for all languages Ctrl + / or in mac ⌘ + /.

2. Ctrl + R:

Renames (with refactor) a variable, method, class or a file. If applied for a variable, the variable is marked in a red rectangle. You type the new name and hit Enter, all references to that variable are updated:Press Esc to cancel renaming.

If the object being renamed is a method or class, then the following dialog gets displayed:Enter a new name, and then click Refactor.You can also preview the changes by clicking the Preview button, and then a refactoring view gets displayed like this:Here you can compare the two versions: the current one versus the refactored one. Then click Do Refactoring to apply the changes.

3. Alt + Delete:

Use this shortcut to safely delete a variable, method or class. That means NetBeans will check for any references before deleting.For example, press Alt + Delete would bring the following dialog:Click Refactor. If references were found, that means you cannot safely delete the item, as shown in the following warning dialog:If there is no warning, NetBeans will delete the item because it’s safe.

4. Ctrl + M:

Moves members from one class to another, or moves a class from one package to another.Here’s the Move Members dialog:And here’s the dialog if the object being moved is a class:

5. Alt + Shift + M:

Extracts a selection of a code block to a new method. The Introduce Method appears as shown in the following screenshot:

6. Alt + Shift + V:

Extracts an existing expression or statement into a new variable. For example, the statement textEmail.getText() appears multiple times so it should be introduced to a variable:Then the Introduce Variable dialog appears like this:Enter the variable name and click OK. Note that the scope of the newly introduced variable is local.

7. Alt + Shift + C:

Introduces a new constant. This shortcut is useful in case you want to convert a String literal to a constant. For example:Then the Introduce Constant dialog appears:You can update the name, and then click OK.

8. Alt + Shift + P:

Introduces a new parameter. This shortcut is useful in case you want to introduce a String literal, numeric literal, boolean literal or an expression to a method parameter. For example, introduce the integer number 500 in the following code to a method parameter:The Introduce Parameter dialog appears:Update the name and click Refactor. Here’s the result:

9. Alt + Shift + E:

Netbeans Shortcut For Mac Windows 10

Introduces a new member/field. Use this shortcut if you want to change scope of a local variable to a class member, or to convert an expression to a field. The Introduce Field dialog looks like the following:

10. Alt + Shift + X:

Introduces local extension. Perhaps this is one of the most complex refactoring features in NetBeans. In short, this creates a subclass or a wrapper class of a selected type in order to have additional methods for that type. Read the following post for more details: Generating (Introduce) Local Extensions.Here’s a screenshot of the

Netbeans Shortcut For Mac Shortcut

Introduce Local Extension dialog:

Other NetBeans Tutorials:

Shortcut

About the Author:

Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.
Details
Written by Nam Ha Minh
Last Updated on 16 February 2020 | Print Email
Do you know that shortcuts help you accelerate your development productivity? Indeed, the more time you use keyboards, the higher efficiency you get. Therefore today I’m going to share with you the common shortcut keys which are designed for editing code in NetBeans IDE.NOTE: Standard shortcuts are not covered, such as Ctrl + Space (auto-complete), Ctrl + A (select all), Ctrl + Z (undo), and the like.
  1. Ctrl + E or Shift + Delete: deletes the current line.
  2. Ctrl + Delete: deletes the next word after the cursor. If it is a compound (i.e. using camel case like fileHandler), then only the first word is deleted.
  3. Ctrl + Backspace: deletes the previous word before the cursor.
  4. Alt + Shift + Up: Moves up the current line (or a selected block of code) by one line:
  5. Alt + Shift + Down: Moves down the current line (or a selected block of code) by one line:

  6. Ctrl + Shift + Up: Copies and moves up the current line (or a selected block of code) by one line:
  7. Ctrl + Shift + Down: Copies and moves down the current line (or a selected block of code) by one line:
  8. Shift + Enter: Inserts a blank line below the current line, regardless of position of the cursor in the current line (it’s very different than pressing Enter key alone):
  9. Ctrl + Enter: Works similar to Shift + Enter, but insert a blank line above the current line if the cursor is at the beginning of line.
  10. Ctrl + Shift + I: Organizes import statements by removing unused imports and adding missing ones:
  11. Alt + Shift + F: Formats a selected block of code or the whole source if no block is selected.
  12. Ctrl + Shift + C or Ctrl + /: Toggles comment for the current line or a selected block of code:
  13. Alt + Insert: Shows context menu to generate code e.g. insert constructor, getters and setters. The list of commands in the menu is depending on the surrounding code:
  14. Ctrl + F12: Inspects members of a class. This opens and activates the Navigator window:
  15. Alt + F12: Inspects hierarchy of a class. This opens and activates the Hierarchy window:
  16. Ctrl + Shift + Enter: Toggles maximize/minimize the current code editor.

Other NetBeans Tutorials:

Download Netbeans For Mac


About the Author:

Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.