- Details
- Written by Nam Ha Minh
- Last Updated on 16 February 2020 | Print Email
1. Alt + Enter:
- 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.
- 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.
- 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.
- 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.
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.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 theNetbeans Shortcut For Mac Shortcut
Introduce Local Extension dialog:Other NetBeans Tutorials:
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
- Ctrl + E or Shift + Delete: deletes the current line.
- 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.
- Ctrl + Backspace: deletes the previous word before the cursor.
- Alt + Shift + Up: Moves up the current line (or a selected block of code) by one line:
- Alt + Shift + Down: Moves down the current line (or a selected block of code) by one line:
- Ctrl + Shift + Up: Copies and moves up the current line (or a selected block of code) by one line:
- Ctrl + Shift + Down: Copies and moves down the current line (or a selected block of code) by one line:
- 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):
- 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.
- Ctrl + Shift + I: Organizes import statements by removing unused imports and adding missing ones:
- Alt + Shift + F: Formats a selected block of code or the whole source if no block is selected.
- Ctrl + Shift + C or Ctrl + /: Toggles comment for the current line or a selected block of code:
- 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:
- Ctrl + F12: Inspects members of a class. This opens and activates the Navigator window:
- Alt + F12: Inspects hierarchy of a class. This opens and activates the Hierarchy window:
- Ctrl + Shift + Enter: Toggles maximize/minimize the current code editor.