# About the Java Source Editor

Use to edit Java source files.

Source Editor Tabs and Commands

The top of the Source Editor has a tab for each open document. Each tab shows the name of the document. If the document has been modified and has not been saved, there is an asterisk (`*`) after its name.

If multiple files are open, you can split the Source Editor view by clicking and dragging the tab. As you drag to different parts of the editing area, you see a red outline that shows you where the new window will open. When one of these boxes appears, you can drop the document and split the pane.

Close the split file if you want the editor to return to its unsplit state.

Element | Description
--- | ---
Close All | Closes all files that are open in the Source Editor area.
Close Other | Closes all files except for the selected file.
Clone | Opens a new tab for the same document. This command is particularly useful in combination with splitting the window so that you can view different parts of the same file simultaneously.
Close Window | Closes the selected file.
Maximize Window | Hides other windows and expands the Source Editor to use all of the window space in the IDE. Toggles to Restore Window. You can also maximize and restore the Source Editor by double-clicking a tab
Restore Window | Returns the windows to the state that they were before you chose Maximize Window. Toggles to Maximize Window. You can also maximize and restore the Source Editor by double-clicking a tab.
Float | Opens a floating IDE window with the tab.
Dock | Restores the tab to the main window, if the tab is floating in a separate window, and closes the floating window.
New Document Tab Group | Splits the editor window into two groups of tabs and separates the selected tab into the new group. Toggles to Collapse Document Tab Group.
Collapse Document Tab Group | Combines separate group of tabs into one group. Toggles to New Document Tab Group.
Select in Projects | Highlights the document in the Projects window.
Show Local History | Opens a window where you `diff` the changes you made to the file since you last saved it. The History tab on the toolbar also opens this window.
[version control] | Opens a list of commands for the version control system. Available if the document is under version control. A menu item with the name of the version control system is listed.
Diff to... | Opens a diff window where you can `diff` the selected document either to another open file or to a file anywhere on your file system.

Source Editor Elements

Use to facilitate navigating, locating specific areas of a file, and editing source files.

Element | Description
--- | ---
Toolbar | The editor toolbar is at the top of the Source Editor window. The toolbar has buttons for various navigating and editing shortcuts, which vary according to the type of file you are editing. Hold the cursor over a button to display a description of the command.
Left Margin | The left margin displays annotation glyphs that indicate line status, such as breakpoints, the program counter, or build errors. Click the left margin of a Java file to set a breakpoint on the corresponding line. Click the left margin of a line to remove a breakpoint. Right-click the left margin to display a context menu. The margin can also optionally display line numbers.
Error Stripe | The error stripe is the strip to the right of the right scroll bar and contains marks for various things in your file, such as errors, bookmarks, and comments for the To Do list. The error stripe represents the whole file, not just the lines currently displayed. You can immediately identify whether your file has any errors without having to scroll through the entire file. Double-click a mark in the error stripe to jump to the line that the mark refers to.
Status Line | The Source Editor status line is beneath the horizontal scroll bar. The first area of the status line shows the current line number and row number in the form `line:row`. The second area of the status line indicates the insertion mode (INS or OVR). The text area on the right is used for status messages.
Syntax Coloring | Source code displayed in the Source Editor is syntactically colored. For example, all Java keywords are shown in blue and all Java comments in light gray. Guarded blocks of Java code generated by the GUI Builder have a light blue background and cannot be edited.
Code Completion | The IDE's code completion feature fills in code and tags as you type. Code completion is available for Java, JSP, HTML, XML, and Ant files.
Pair Completion | The Source Editor does matching of pair characters such as brackets, parentheses, and quotation marks as you edit Java classes. Closing characters are not duplicated if you type them yourself rather than letting the editor add them for you.
Insert Mode and Overwrite Mode | In insert mode, the default insertion point is a vertical bar, and text that you type is inserted. In overwrite mode, the default insertion point is a solid block, and text that you type replaces the existing text. Use the Insert key to toggle between the two modes. Whenever the insertion point in the Source Editor is located immediately after a brace, bracket, or parenthesis, the matching brace, bracket, or parenthesis is highlighted.

If the Source Editor beeps when you try to enter new text, the file is a read-only file.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.