<commit_before>= jMonkeyEngine SDK: Code Editor and Palette
:revnumber:2.0
:revdate: 2020/07/09
:keywords: documentation, sdk, editor


The Source Code Editor is the central part of the jMonkeyEngine SDK. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features.

Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "`see also`" links).


== Code Completion and Code Generation

While typing Java code in the source code editor, you will see popups that help you to write more quickly by completing keywords, and generating code snippets. Additionally, they will let you see the javadoc for the classes you are working with.

[.right]
image::sdk/netbeans_code_completion.png[netbeans_code_completion.png,width="",height=""]


*Code Completion*

*  Complete keyword / method / variable: kbd:[Ctrl+Space] +
Alternatively you can also use kbd:[Ctrl+\\]
**  Customize Code Completion options: menu:Tools[Options > Editor > Code Completion]

*  Show expected parameters of this method in a tooltip: kbd:[Ctrl+P]
*  Complete any string (even non-Java) that has been used before: kbd:[Shift+Ctrl+K]

*Code Generation*

*  Auto-fix import statements: kbd:[Ctrl+Shift+I]
*  Auto-generate getters/setters, try/catch, equals/hashCode: kbd:[Alt+Insert]
**  Customize code completion: Choose menu:Tools[Options > Editor > Code Completion]

*  Auto-generate common code snippets such as loops, declarations, println, by typing the *template name* + kbd:[Tab]
**  Customize code templates: Choose menu:Tools[Options > Editor > Code Templates]

*  Rename, move, or introduce methods, fields, and variables, without breaking the project: *Refactoring menu*


== Semantic and Syntactic Coloring

[.right]
image::sdk/jmonkeyplatform-docu-5.png[jmonkeyplatform-docu-5.png,width="421",height="298"]


The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.

Examples:

*  Java keywords are *blue*, variables and fields are *green*, parameters are *orange*.
*  +++<strike>Strikethrough</strike>+++ means deprecated method or field.
*  +++<u>Gray underline</u>+++ means unused variable or method.
*  Place the caret in a method or variable and all its ocurrences are marked *tan*.
*  Place the caret in a method's return type to highlight all exit points
*  and many more…

To customize Colors and indentation:

*  menu:Tools[Options > Editor > Formatting]
*  menu:Tools[Options > Fonts and Colors]


== Editor Hints and Quick Fixes (a.k.a. Lightbulbs)

Editor hints and quick fixes show as lightbulbs along the left edge of the editor. They point out warnings and errors, and often propose useful solutions!

*  Execute a quick fix: Place the caret in the line next to the lightbulb and press kbd:[Alt+Enter] (or click the lightbulb)
**  Customize hints: Choose menu:Tools[Options > Editor > Hints]



== Javadoc

*  Place the caret above a method or a class that has no Javadoc, type
+
[source,html]
----
/**
----
and press Enter: The editor generates skeleton code for a Javadoc comment.
*  btn:[RMB] click the project in the Projects window and choose Generate Javadoc.
*  btn:[RMB] click a file and choose menu:Tools[Analyze Javadoc]

To display a javadoc popup in the editor, place the caret in a line and press kbd:[Ctrl+Space] (Alternatively use kbd:[Ctrl+\\]).

*  If the javadoc popup doesn't work, make certain that
**  You have the Java JDK documentation installed and set up: menu:Tools[Java Platforms]
**  You downloaded and set up javadoc for third-party libraries: menu:Project properties[Libraries > Edit]



== Navigating the jME3 Source

When the JavaDoc does not deliver enough information, you can have a look at the source of every method or object of jME3 that you use. Just btn:[RMB] click the variable or method, select menu:Navigate[Go to source] and an editor will open showing you the source file of jME3.


== Palette

[.float-group]
--
[.right]
image::sdk/jmonkeyplatform-docu-4.png[jmonkeyplatform-docu-4.png,width="421",height="298"]


Choose menu:Windows[Palette] to open the context-sensitive Palette. The jMonkeyEngine SDK provides you with jme3 code snippets here that you can drag and drop into your source files.

*  Examples: Node and Model creation code snippets.
--

[TIP]
====
Choose menu:Tools[Add to Palette] from the menu to add your own code snippets to the Palette. (not available yet in beta build)
====


== Keyboard Shortcuts

Keyboard Shortcuts save you time when when you need to repeat common actions such as Build&amp;Run or navigation to files.

*  Go to File: kbd:[Alt+Shift+O]
*  Go to Type: kbd:[Ctrl+O]
*  Open in Projects / Files / Favorites window: kbd:[Ctrl+Shift+1]/ kbd:[2] / kbd:[3]
*  Build&amp;Run the main class of the Project: kbd:[F6]
*  Run the open file: kbd:[Shift+F6]
*  Switch to Editor / Projects / Files / Navigator: kbd:[Ctrl+0] /kbd:[1] / kbd:[3] / kbd:[7]
*  Indent code: kbd:[Ctrl+Shift+F]

By default, jMonkeyEngine uses the same link:http://netbeans.org/project_downloads/www/shortcuts-6.5.pdf[Editor Shortcuts] as the NetBeans IDE, but you can also switch to an Eclipse Keymap, or create your own set.

*  Customize keyboard shortcuts: menu:Tools[Options > Keymap]


== Tips and Tricks

*  To browse the physical file structure of your project, use the Files window: kbd:[Ctrl+2]
*  To open a file that is not part of a Java project, add it to the Favorites window: kbd:[Ctrl+3]
*  If you cannot find a particular menu item or option panel, use the IDE Search box in the top right! kbd:[Ctrl+i]
*  If a code block, class, or javadoc is quite long and you don't want to scroll over it, click the *+/-* signs to collapse (fold) the code block temporarily.
*  Press kbd:[F1] for Help

'''

See also

*  link:http://netbeans.org/kb/docs/java/editor-codereference.html[Code Assistance]
<commit_msg>fix escape \<commit_after>= jMonkeyEngine SDK: Code Editor and Palette
:revnumber:2.0
:revdate: 2020/07/09
:keywords: documentation, sdk, editor


The Source Code Editor is the central part of the jMonkeyEngine SDK. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features.

Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "`see also`" links).


== Code Completion and Code Generation

While typing Java code in the source code editor, you will see popups that help you to write more quickly by completing keywords, and generating code snippets. Additionally, they will let you see the javadoc for the classes you are working with.

[.right]
image::sdk/netbeans_code_completion.png[netbeans_code_completion.png,width="",height=""]


*Code Completion*

*  Complete keyword / method / variable: kbd:[Ctrl+Space] +
Alternatively you can also use kbd:[Ctrl+\ ]
**  Customize Code Completion options: menu:Tools[Options > Editor > Code Completion]

*  Show expected parameters of this method in a tooltip: kbd:[Ctrl+P]
*  Complete any string (even non-Java) that has been used before: kbd:[Shift+Ctrl+K]

*Code Generation*

*  Auto-fix import statements: kbd:[Ctrl+Shift+I]
*  Auto-generate getters/setters, try/catch, equals/hashCode: kbd:[Alt+Insert]
**  Customize code completion: Choose menu:Tools[Options > Editor > Code Completion]

*  Auto-generate common code snippets such as loops, declarations, println, by typing the *template name* + kbd:[Tab]
**  Customize code templates: Choose menu:Tools[Options > Editor > Code Templates]

*  Rename, move, or introduce methods, fields, and variables, without breaking the project: *Refactoring menu*


== Semantic and Syntactic Coloring

[.right]
image::sdk/jmonkeyplatform-docu-5.png[jmonkeyplatform-docu-5.png,width="421",height="298"]


The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.

Examples:

*  Java keywords are *blue*, variables and fields are *green*, parameters are *orange*.
*  +++<strike>Strikethrough</strike>+++ means deprecated method or field.
*  +++<u>Gray underline</u>+++ means unused variable or method.
*  Place the caret in a method or variable and all its ocurrences are marked *tan*.
*  Place the caret in a method's return type to highlight all exit points
*  and many more…

To customize Colors and indentation:

*  menu:Tools[Options > Editor > Formatting]
*  menu:Tools[Options > Fonts and Colors]


== Editor Hints and Quick Fixes (a.k.a. Lightbulbs)

Editor hints and quick fixes show as lightbulbs along the left edge of the editor. They point out warnings and errors, and often propose useful solutions!

*  Execute a quick fix: Place the caret in the line next to the lightbulb and press kbd:[Alt+Enter] (or click the lightbulb)
**  Customize hints: Choose menu:Tools[Options > Editor > Hints]



== Javadoc

*  Place the caret above a method or a class that has no Javadoc, type
+
[source,html]
----
/**
----
and press Enter: The editor generates skeleton code for a Javadoc comment.
*  btn:[RMB] click the project in the Projects window and choose Generate Javadoc.
*  btn:[RMB] click a file and choose menu:Tools[Analyze Javadoc]

To display a javadoc popup in the editor, place the caret in a line and press kbd:[Ctrl+Space] (Alternatively use kbd:[Ctrl+\ ]).

*  If the javadoc popup doesn't work, make certain that
**  You have the Java JDK documentation installed and set up: menu:Tools[Java Platforms]
**  You downloaded and set up javadoc for third-party libraries: menu:Project properties[Libraries > Edit]



== Navigating the jME3 Source

When the JavaDoc does not deliver enough information, you can have a look at the source of every method or object of jME3 that you use. Just btn:[RMB] click the variable or method, select menu:Navigate[Go to source] and an editor will open showing you the source file of jME3.


== Palette

[.float-group]
--
[.right]
image::sdk/jmonkeyplatform-docu-4.png[jmonkeyplatform-docu-4.png,width="421",height="298"]


Choose menu:Windows[Palette] to open the context-sensitive Palette. The jMonkeyEngine SDK provides you with jme3 code snippets here that you can drag and drop into your source files.

*  Examples: Node and Model creation code snippets.
--

[TIP]
====
Choose menu:Tools[Add to Palette] from the menu to add your own code snippets to the Palette. (not available yet in beta build)
====


== Keyboard Shortcuts

Keyboard Shortcuts save you time when when you need to repeat common actions such as Build&amp;Run or navigation to files.

*  Go to File: kbd:[Alt+Shift+O]
*  Go to Type: kbd:[Ctrl+O]
*  Open in Projects / Files / Favorites window: kbd:[Ctrl+Shift+1]/ kbd:[2] / kbd:[3]
*  Build&amp;Run the main class of the Project: kbd:[F6]
*  Run the open file: kbd:[Shift+F6]
*  Switch to Editor / Projects / Files / Navigator: kbd:[Ctrl+0] /kbd:[1] / kbd:[3] / kbd:[7]
*  Indent code: kbd:[Ctrl+Shift+F]

By default, jMonkeyEngine uses the same link:http://netbeans.org/project_downloads/www/shortcuts-6.5.pdf[Editor Shortcuts] as the NetBeans IDE, but you can also switch to an Eclipse Keymap, or create your own set.

*  Customize keyboard shortcuts: menu:Tools[Options > Keymap]


== Tips and Tricks

*  To browse the physical file structure of your project, use the Files window: kbd:[Ctrl+2]
*  To open a file that is not part of a Java project, add it to the Favorites window: kbd:[Ctrl+3]
*  If you cannot find a particular menu item or option panel, use the IDE Search box in the top right! kbd:[Ctrl+i]
*  If a code block, class, or javadoc is quite long and you don't want to scroll over it, click the *+/-* signs to collapse (fold) the code block temporarily.
*  Press kbd:[F1] for Help

'''

See also

*  link:http://netbeans.org/kb/docs/java/editor-codereference.html[Code Assistance]

{'fraction_non_alphanumeric': 0.09142334248398636, 'fraction_numerical': 0.007320522419099909, 'mean_word_length': 4.581244196843083, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5614763', 'n_tokens_mistral': 3814, 'n_tokens_neox': 3530, 'n_words': 1568}