Writing and Formatting Source Code

To create program elements such as classes, methods, and fields, use the VisualAge for Java SmartGuides, which will generate the basic code for you.  To fill in the functionality of classes and methods, type in the source code in the Source panes that most browser pages have.  These Source panes are typical text editors, except that they save your code not to files but to the containing program element in the workspace and repository.  The Workbench, program element browsers and various other windows such as the Debugger browser, the Scrapbook, and the Search Results window, have Source panes. 

Formatting Source Code
On the Formatter page of the Options dialog, you can set the Source panes to automatically give you new lines when you start a compound statement or use and opening brace character.

On the Indentation page of Options dialog, you can change the way that source is indented as you type it in.

If you want to apply these formatting settings to methods and class declaration code that was written before you made the settings, or to code that you import from the file system, select Format Code from the Edit menu.  The changes will be applied to the program element currently in the Source pane.

Warning:  The Format Code action removes whitespace (blank lines) from methods and class declarations.

ngrelc.gif (533 bytes)
Development Without Files
Projects and Other Program Elements
The Scrapbook

ngrelt.gif (466 bytes)
Browsing the Workspace
Creating a Class
Creating an Interface
Creating a Method
Printing Source Code and Other Text
Saving Changes to Code
Searching for Declarations of and References to a Program Element
Searching for Text in a Source Pane
Setting IDE Options

ngrelr.gif (548 bytes)
Code Assist