Opening a Java editor
In this section, you will learn how to open an editor for Java files. You will also learn about some of the basic Java editor features.
- Expand the package junit.samples and select the file VectorTest.java.
You can open VectorTest.java in the Java editor by double clicking on
it. In general you can open a Java editor for Java files, types, methods and fields by simply double
clicking on them. For example, to open the editor directly on the method testClone
defined in VectorTest.java, expand the file in the Package Explorer and double click on the method.
- Notice the syntax highlighting. Different kinds of elements in the
Java source are rendered in unique colors. Examples of Java source
elements that are rendered differently are:
- Regular comments
- Javadoc comments
- Look at the Outline view. It displays an outline of the Java file including
the package declaration, import declarations, fields, types and methods. The
Outline view uses icons to annotate Java elements. For example, icons indicate whether a Java element is
or final (). Different icons show you whether a method overrides a method from a
base class (
when it implements a method from an interface (
- Toggle the Hide Fields, Hide Static Members,
and Hide Non-Public Members buttons in the Outline view toolbar
to filter the view's display.
Before going to the next step make sure that the Hide Non-Public
Members and Hide Static Fields and Methods
buttons are not pressed.
- In the Outline view, select different
elements and note that they are again displayed in a whole file view
in the editor. The Outline view selection now contains a range indicator
on the vertical ruler on the left border of the Java editor that indicates
the range of the selected element.
Sorting elements in Java views
Java Outline View
Java Editor Preferences