How to Open Ssame Disposed Window Again in Netbeans
The editor helps you quickly complete or generate code through the "smart" code completion feature. Code completion is very useful when you want to fill in missing code, it allows you to look at the available options within the context of your application, and generates fragments of code when required. See below for examples of how to use code completion.
Invoking Code Completion
To invoke code completion press Ctrl+Space or, choose Source > Complete Code… from the menu bar and a list of appropriate suggestions is presented to y'all. As you keep to type, lawmaking completion becomes more than focussed and the listing shortens. The list includes options imported in your source file and symbols from the coffee.lang
package.
To customize the code completion settings, select:
Windows ™ | Tools > Options > Editor > Code Completion |
macOS ™ | NetBeans > Preferences… > Editor > Code Completion |
You can set code completion to pop-upwards an options listing either automatically or, on an as-needed basis. In the Lawmaking Completion pane for Language: All Languages, select the Motorcar Popup Completion Window checkbox to invoke lawmaking completion automatically when yous type certain characters. The default character for Linguistic communication: Java is " .
", only y'all can add together your ain characters.
To add together characters that will invoke lawmaking completion, select the Linguistic communication: Java pane and type your characters in the Auto Popup Triggers for Java: field. The code completion list will pop-upwards every time you type one of your specified characters, simply select your desired choice, hit return or "double-click", for it to be entered into your document.
When the Auto Popup Completion Window checkbox is not selected, y'all need to press Ctrl+Space each time y'all want to invoke code completion.
Instead of using Ctrl+Space for code completion, you lot tin can use "hippie completion". Hippie completion analyzes text in the visible telescopic by searching your electric current document and, if not found, in other documents. Hippie completion and so provides suggestions to complete the current give-and-take with a keyword, class proper noun, method, or variable. To invoke hippie completion press:
Windows™/Linux | Ctrl+Yard |
macOS™ | Command+Chiliad |
and the editor automatically completes the give-and-take you're typing. Repeatedly pressing the appropriate cardinal combination volition cycle in one case through all bachelor options. If you go past your desired selection and so press the shift fundamental besides as your key combination and you lot can reverse.
The first fourth dimension Ctrl+Infinite is pressed only items matching the type, in this example an int
, are shown.
Press Ctrl+Space a 2d time and all bachelor items are shown, regardless of whether they match the provided type, as shown below.
Too, y'all can select for Language: Java the Auto Popup on Typing Whatever Java Identifier Role checkbox and, every bit you blazon keywords etc., code completion automatically presents you with an advisable list of options.
Smart Suggestions at the Top
Lawmaking completion is "smart", and volition present the most relevant suggestions at the tiptop, above the black line in the code completion listing.
In the example below, the editor suggests inserting the LinkedHashMap
constructor from the coffee.util
package.
If the "smart" suggestions are non the ones you want to use, press Ctrl+Space again to come across the complete list.
Camel Case Completion
Instead of typing consecutive characters, and then calling code completion, you can blazon the initial capital letters of the give-and-take you're interested in.
For example, type IE
, press Ctrl+Space , and y'all will run into a list of suggestions that match via camel case completion using the letter I
and then the letter E
.
Completing Keywords
Use code completion to consummate keywords in your code. The editor analyzes the context and suggests the almost relevant keywords.
In the example beneath, the ColorChooser
grade needs to extend the JPanel
class. You tin speedily add the keyword extends
from the suggested items.
Suggesting Names for Variable and Fields
When yous are adding a new field or a variable, use code completion to choose a name that matches its type.
Blazon a prefix for the new name, printing Ctrl+Space and select the name you want to use from the list of suggestions.
Suggesting Parameters
The editor determines the most likely parameters for variables, methods, or fields and displays the suggestions in a popular-up box.
For instance, when y'all select a method from the code completion window which has one or more arguments, the editor highlights the first argument and displays a tooltip suggesting the format for this argument. To movement to the side by side argument, press the Tab or Enter keys.
Y'all tin invoke the tooltips with method parameters by pressing:
Windows™/Linux | Ctrl+P |
macOS™ | Control+P |
or, selecting Source > Bear witness Method Parameters from the card bar at any time.
Mutual Prefix Completion
You tin can employ the Tab key to speedily fill in the about commonly used prefixes and single suggestions. To check out how this feature works, endeavour typing the following:
Type System.out.p
and wait for code completion to show all fields and methods that first with "p". All the suggestions volition be related to "print".
Press the Tab key and the editor automatically fills in the "print". You can keep and type "l" and, after pressing Tab again, "println" will be added.
Subword Completion
Sometimes you may non remember how an item starts, making it difficult to use code completion. For instance, to run into all items that chronicle to listening to property changes, you can utilise subword completion, so if yous blazon prop
you volition see all method calls that relate to property change listening.
To implement this feature, select:
Windows™/Linux | Tools > Options > Editor > Code Completion |
macOS™ | NetBeans > Preferences… > Editor > Code Completion |
then select in the Language: Java pane, the Subword completion checkbox.
You lot can and then type part of the method yous want to call, in this example prop
, and so invoke code completion, relevant alternatives all applicative to properties on the object, in this case, are displayed.
Concatenation Completion
When you need to type a chain of commands, you can use code completion. By pressing Ctrl+Space twice all bachelor chains will be shown. The editor scans: variables, fields, and methods that are in the visible context. Information technology volition then suggest a concatenation that satisfies the expected blazon.
Completion of Static Imports
When you want to complete a statement and, at the same time, require to make utilise of a static import statement, utilize code completion. By pressing Ctrl+Space twice, all available static import statements volition be shown.
If you would like static import statements to be added automatically, select:
Windows™/Linux | Tools > Options > Editor > Formatting |
macOS™ | NetBeans > Preferences… > Editor > Formatting |
then from the Language: Java, Category: Imports pane select the Prefer Static Imports checkbox.
Excluding Items from Completion
Time can be wasted when code completion returns classes that you seldom or never apply. When you invoke code completion, a lightbulb within the returned items indicates that you tin exclude them from the lawmaking completion list.
You can add or modify your exclusion rules either when "Configure excludes" is selected from the code completion list or, by selecting:
Windows™/Linux | Tools > Options > Editor > Code Completion |
macOS™ | NetBeans > Preferences… > Editor > Lawmaking Completion |
then in the Language: Java pane, make your changes to the Packages/classes: list.
JPA Completion
When you are using the Java Persistence Annotation specification (JPA), y'all can complete SQL expressions in @NamedQuery
statements via code completion.
In the lawmaking completion window, icons are used to distinguish different members of the Coffee language. See Appendix A: Icons in the Code Completion Window at the end of this document to see the meanings of these icons.
Source: https://netbeans.apache.org/kb/docs/java/editor-codereference.html
0 Response to "How to Open Ssame Disposed Window Again in Netbeans"
Post a Comment