text: This chapter provides an overview of the tools and features that JDeveloper provides to help you develop Java applications.
  This chapter includes the following sections:
  Section 17.1, "About Developing Java Applications"
  Section 17.2, "About the Java Source Editor"
  Section 17.3, "Understanding Java Source Editor Features"
  Section 17.4, "Setting Preferences for the Java Source Editor"
  Section 17.5, "Using Toolbar Options"
  Section 17.6, "Using the Quick Outline Window"
  Section 17.7, "About the Java UI Visual Editor"
  JDeveloper enables you to build and assemble Java applets and client applications using JavaBeans, and interactive, desktop-based GUI applications using Swing and AWT components. You can also create and run Java client applications with Java Web Start within the JDeveloper IDE.
  JDeveloper provides resources for editing, optimizing, running, and debugging Java code:
  Editing Java Source Files - The Source Editor supports several Java-aware editing features. For more information, see Section 18.3, "Editing Java Code".
  Building Apache Ant - Compile projects using the Make and Rebuild commands, or Apache Ant. For more information, see Section 18.6, "Building Java Projects".
  Running Java Programs - Keep track of processes that are run, debugged, or profiled. For more information, see Chapter 19, "Running and Debugging Java Programs"
  Debugging Java Programs - Tools for local and remote debugging. For more information, see Section 19.6, "About the Debugger"
  Java Beans Components - JavaBeans Components technology lets you implement your own framework for data retrieval, persistence, and manipulation of Java objects. For more information, see Section 18.7, "Working with JavaBeans".
  Refactoring Java Projects - A collection of automated refactoring operations that modify code structure without altering program behavior. For more information, see Section 18.8, "Refactoring Java Projects".
  Optimizing Application Performance - Tools for analyzing the quality and performance of your Java code. For more information, see Section 18.9, "Optimizing Application Performance".
  Modeling Java Classes - Tools to visually create Java classes and interfaces, or to graphically view existing Java classes and interfaces. For more information, see Section 18.11, "Modeling Java Classes".
  Unit Testing for JUnit - Tools to write and run tests that verify Java code, using the open source JUnit framework. For more information, see Section 18.12, "Unit Testing with JUnit".
  The Java Source Editor displays Java source files, and facilitates editing of Java code. The Java Source editor is a specialized form of the generic Source Editor that JDeveloper provides for editing source code across several technologies, including XML, JSP, and HTML.
  In additional to the Java-specific features of the Java Source Editor, you can also use the common set of features that JDeveloper provides to enhance coding across all domains. These features are available through the context menu or the Source menu.
  Double-clicking a node in the Application Navigator either opens or brings the default editor to the foreground. When a file is open in the Source Editor, its corresponding elements are displayed hierarchically in the Structure window. Double-clicking a node in the Structure window shifts the focus to the definition of that element in the Source Editor.
  You can customize the behavior of the Java Source Editor by specifying preferences in the Preferences Dialog.
  The Java Source Editor provides features to enable easier and quicker navigation through. For example, it tells you which methods you can call from any given method.
  You can use Code Insight to speed up the process of writing code. Code Insight has two varieties: completion insight and parameter insight. You can enable or disable each independently and set the delay in seconds for each to appear when the cursor is paused at an appropriate insertion point.
  To invoke completion after typing the period separator or, in the default keymap, press Ctrl+Space. To invoke parameter insight, pause after typing an opening (the left) parenthesis or, in the default keymap, press Ctrl+Shift+Space. To exit either type of insight at any time, press Esc. Note that if you change your keymapping, these keyboard accelerators may change. You can click QuickDoc, located at the bottom right of the completion insight list, to display the Javadoc for the currently selected element
  After a method has been completed by completion insight, the source editor automatically fills in the parameters based on the method code. You can tab between these parameters, and edit them manually or using parameter insight.he source editor will automatically add an import if it can find only one exact match for an unresolved reference to a class. You can set preferences for this feature in the Preferences Dialog.
  To change Code Insight settings or to view or change accelerators, from the main menu choose Tools > Preferences to open the Preferences dialog and then navigate to the appropriate page. For more information, see Section 17.4.1, "How to Set Code Insight Options for the Java Source Editor"
  Use the Code Insight feature to quickly add annotations to your Java code. An annotation is used to associate information with a program element. Annotations can be used in classes, fields, methods, parameters, local variables, constructors, enumerations, and packages. To add annotations in your Java code: declare the annotation, create a function, and then add your annotations.
  When you start adding an annotation, Member Insight (Ctrl-Space) displays a list of options (fields, members, classes) based on the statement context. Parameter Insight (Ctrl-Shift-Space) displays information about the annotation like the names of the elements of the annotation type, the default values, and the created values. It also highlights the element currently under the cursor in the annotation.
  For more information see Section 18.5, "How to Customize Javadoc Options for the Java Source Editor."
  You can hold down the Shift key and then hover over a variable or method to show its definition in a ghost window. This feature makes it convenient to quickly view code without moving cursor focus from your current code.
  While dragging the vertical scroll bar, a small tip window appears next to the bar, revealing the methods that are visible or partially visible on screen. This enables you to more easily see what methods are in view while quickly scrolling. You can also see the name of the method whose beginning is not immediately in view.
  To search incrementally, from the main menu choose Search > Incremental Find Forward or Search, then Incremental Find Backward. In the dialog that appears, begin typing. As you type, the cursor jumps to the next instance of that particular letter combination, either forward or backward. The search does not support wildcards.
  Shortcut keys, or accelerators, are combinations of keys that you can use to navigate or to perform certain operations using the keyboard instead of the mouse. You can select from a variety of predefined keymaps or define your own accelerators.
  To view or change existing accelerators, to define new accelerators, or to load preset keymaps, from the main menu choose Tools, then Preferences to open the Preferences dialog and then navigate to the Shortcut Keys page. To view or change accelerators for the editor, select Code Editor from the Category list.
  Note that block commenting is indicated by Toggle Line Comments. It is defined in the default keymap as Ctrl-Shift-Slash or Ctrl-Slash.
  While bookmarking code:
  You can see a list of all bookmarks you have created in a Bookmarks window. This window appears when you click the Go to Bookmark icon. This window also displays the line number and method name that contains the bookmark.
  You can create numbered bookmarks using the keyboard shortcut Ctrl-Shift-number. You can quickly navigate to that bookmark with Ctrl-number.
  To navigate to the source for any identifier in an open Java file, right-click on the identifier you would like to browse and choose Go to Declaration. Alternatively, you can hold down the Ctrl key and click on an identifier to navigate to its source. If the source is not available, JDeveloper will reverse-engineer the class file.You may browse imported classes and interfaces, member fields and methods, and local variables. If you are browsing a method or constructor invocation, this declaration search will resolve the types in order to determine the correct method or constructor invocation. For instance, the code in Example 17-1 revokes the declaration search at SetText. It brings up the source code for
  javax.swing.JButton, with the
  SetText() method displayed.
  Example 17-1 Revoking the Declaration Search
  import javax.swing.JButton ... JButton b1 = new JButton(); ... b1.SetText: ('OK');
  If the identifier cannot be browsed or if there is nothing at that cursor position, this search command on the context-sensitive menu will be disabled. If JDeveloper is unable to locate the appropriate location to jump to or if the identifier cannot be browsed due to access restrictions (for example, private members), the Java Source Editor's status bar will display a message indicating so.
  Code templates are sections of pre-written code that can be conveniently inserted into source file to avoid typing it in manually. Templates can intelligently modify the inserted code to suit its surrounding code, and imports required by code templates are automatically imported. You can use shortcuts to speed up the selection of the required template. Pressing Ctrl+Enter anywhere in the source file brings up a list of code templates that you can select. The templates provided in this list are contextual and only those suitable for the current location are offered. You can click QuickDoc on the bottom right corner of this list to see the structure of the selected code template.If you were using the existing template for the for loop, for instance, you would type for and then (in the default keymapping) press Ctrl+Enter. The template would then be filled in as follows:
  for (;;)
  A complete list of all code templates is available in the Code Editor Help.To edit or create code templates, or to view or change accelerators, from the main menu choose Tools > Preferences to open the Preferences dialog and then navigate to the appropriate page.
  For more information, see Section 18.3.9, "How to Use Code Templates."
  You can customize the behavior of the Java Source Editor using the Preferences Dialog.
  You can also use the Preferences Dialog to specify settings for the general source editing environment.
  You can set various Insight options to create the behavior you want.
  To set the options for Code Insight as it applies to Java:
  From the main menu, choose Tools > Preferences.
  In the Preferences dialog, expand the Code Editor node.
  Expand the Java node and select Code Insight.
  On the Java Insight page, set the options you want.
  Click OK.
  JDeveloper enables you to set comment and brace-matching options for the Java source editor.
  To set the options for Java comment and brace matching in the source editor:
  From the main menu, choose Tools > Preferences.
  In the Preferences dialog, expand the Code Editor node.
  Select the Display node.
  On the Display page, enable or disable automatic brace matching and set the delay time.
  Click OK.
  Reopen the Preferences dialog, expand the Code Editor node, and select the Java node.
  On the Java page, set the attributes for comments and brace matching to create the behavior that you want.
  Click OK.
  Note that block commenting is an accelerator function. In the default keymap, use Ctrl+Shift+/ or Ctrl+/ to block-comment Java code.
  You can view assistance that enables you to organize import statements in the Java Source Editor.
  To enable assistance for automatically adding import statements:
  From the main menu, choose Tools > Preferences.
  In the Preferences dialog, expand the Code Editor node.
  Expand the Java node and select Imports.
  On the Imports page, select Enable Auto-Popup for Import Assistance.
  Click OK.
  You can set options to sort import statements in the Java Source Editor.
  To set the options for sorting import statements:
  From the main menu, choose Tools > Preferences.
  In the Preferences dialog, expand the Code Editor node.
  Expand the Java node and select Imports.
  On the Imports page, set the attributes to create the behavior that you want when sorting import statements in the editor.
  Click OK.
  The Java Source Editor displays Java source files, and facilitates editing of Java code. Icons that perform various features are located at the top of the Java Source Editor, as described in Table 17-1.
  Clicking the Quick Outline Toolbar icon directly to the right of the Find field brings up the Quick Outline window shown in Figure 17-1. This window floats just above the code and contains a tree of the available methods and fields of the current class and its super classes. You can instantly start typing in a filter field to reduce the visible items, allowing quick and easy selection for navigation to the desired place.
  Table 17-2 lists the available icons and options.
  The Java UI Visual Editor displays the visual components of a user interface in Editing mode. Note: You can use the Java Visual Editor for Swing/AWT Applications only.
  When a Java Visual Editor is open, its corresponding elements are displayed hierarchically in the Structure window. If the Property Inspector is open, selecting elements in either the Structure window or the Java Visual Editor changes the selection in the Inspector as well.
  The Java Visual Editor displays a GUI hierarchy. If these are menu items, the hierarchy is displayed in one fashion; if these are nonmenu items, it is displayed in another. The mode of presentation differs, as the sort of editing that you are engaged in differs. For more information, see Section 18.2.9, "How to View the Hierarchy of a Class or Interface."
  When the node is selected in the Navigator, its GUI structure also displays in the Structure window. All nonmenu GUI items for this object appear under a node labeled UI. Any menu items appear under a node labeled Menu. Any non-GUI items appear under a node labeled Other. Once you have opened the Java Visual Editor for an object in the Navigator, to switch between the display of nonmenu GUI elements and menu elements you have only to click on a node below these UI or Menu nodes in the Structure window.
  Because the display in the Java Visual Editor is rooted in the GUI hierarchy, when you click on a node (for all GUI objects) in the Structure window what loads into the editor is the visual representation of the root node and all its descendants: the entire hierarchy opens, regardless of which node in the hierarchy you selected. What displays in the editor reflects the complete GUI hierarchy; the specific element selected in the display reflects the specific node selected in the window. Selections in the Structure window and the Java Visual Editor are kept in synch.
  If you have an orphan node in the Structure window, that node and its descendants comprise the entire hierarchy, with the orphan being the root of the hierarchy. The Java UI display will reflect this. If you had a control, for instance, that was not parented, and you selected the node for that control, the control and any descendants would now appear in the editor, without a container. Any changes you make to that control, however, will result in generated code.
  Right-click anywhere within the Java Visual Editor to bring up a context-sensitive menu of commands. The context menus differ, depending upon whether you are editing nonmenu or menu items, and the commands available within the context menu depend on the selected object..
  For more information, see Section 20.1, "About Implementing Java Swing User Interfaces."