The JBuilder environment

This chapter introduces you to the JBuilder integrated development environment (IDE). The remaining chapters in the User's Guide explain how to perform specific programming tasks with JBuilder.

This chapter pays particular attention to the AppBrowser. After reading this chapter you will understand how to use the different modes of the AppBrowser to navigate through your programs, projects, files, packages and code elements. You will also understand how to drill down into code elements like classes, methods and interfaces to see their deeper structure. Because program development in JBuilder is centered around the AppBrowser, we recommend that you read this chapter before reading the rest of the User's Guide.

This chapter provides you with overviews of:


Starting JBuilder

When you first open JBuilder, you see JBuilder's main window and AppBrowser. The AppBrowser displays the Welcome project, Welcome.jpr. The HTML file in the project, Welcome.html, is displayed in the Content pane of the AppBrowser.

Creating a default jbuilder.ini file

You can restore all the JBuilder environment settings to the default values. If the jbuilder.ini file doesn't exist, it will be automatically created and maintained.

To restore the JBuilder default environment,

  1. Save your files, and select File|Exit.
  2. Delete or archive the file bin\jbuilder.ini.
  3. Start JBuilder.
    A jbuilder.ini file is created in the bin directory.


The main window

The main window is at the top of the screen when you open JBuilder. It contains the menu bar, the tool bar and the Component Palette.

The menu bar

The menu bar is at the top of the main window. You can select a menu command, then press F1 to display context-sensitive help for that command.

The following table provides brief descriptions of menu commands.


Menu Commands for

File menu Creating, opening, closing, renaming and saving files and projects; removing files from projects; configuring printers; printing files.
Edit menu Copying, pasting, deleting and selecting text; undoing and redoing actions.
Search menu Finding and replacing text; searching for text incrementally and by line number; searching for text across a source path; searching for a symbol.
View menu Viewing Debugger windows, a new AppBrowser, the next or previous error message, the tool bar or the Component Palette.
Build menu Making or building the selected node.
Run menu Running the application or applet; stepping over or tracing into code; running to the end of a selected method; pausing the program; setting watches or breakpoints; inspecting, evaluating and modifying.
Wizards menu Running utility wizards for tasks such as implementing an interface, overriding a method, bundling resources, and wrapping an applet.
Tools menu Displaying the Environment Options dialog; invoking the Windows Notepad and Calculator and other internal tools.
Help menu Displaying documentation, such as the Help system, the BeansExpress tutorial for creating Java Bean components, the JDK API Reference, and the JBCL API Reference. Also for viewing the Borland Online web site in your default web browser, loading the Welcome project for experimenting, and seeing information about this release of JBuilder.


The AppBrowser

JBuilder is structured to increase your productivity as a Java developer. Because Java projects use many files, and because the various development tasks (such as editing, debugging, and browsing for information) have traditionally used multiple windows, it can be difficult to find the window you need.

To simplify your job, JBuilder introduces a new concept in user interfaces for development environments: a single AppBrowser that is used to perform all the usual development functions. The JBuilder AppBrowser lets you to explore, edit, design, and debug all in one unified window.

The JBuilder AppBrowser usually fills the screen area below the main window. If you are running JBuilder, and don't have an AppBrowser displayed, choose Help|Welcome Project now to view it. The AppBrowser will look like the figure in the section called Starting JBuilder.

The AppBrowser usually contains three panes:

Although you will usually have only one AppBrowser visible, you can open additional AppBrowsers as needed, for example, to view more than one project at a time.

See also:
AppBrowser modes

AppBrowser modes

The AppBrowser has two sets of tabs to control the type of view you see. One set is at the bottom of the Structure pane and the other set is at the bottom of the Content pane. Different tabs appears, depending on what you are doing.

The browser as a whole is called the AppBrowser. When you switch the AppBrowser into a different mode, such as Project mode, you can think of this as the Project Browser.

The AppBrowser can display the following modes:

To return to the starting state to see your code, click the Project tab, then the Home button.

See also:
F1 Help: Tabs in the AppBrowser

The Navigation pane

The Navigation pane is the top left pane of the AppBrowser. This pane shows a list of one or more files. In the case of the Project Browser, you will see the project (.jpr) file first. Attached to that is a list of the files in the project. The list may include .java, .html, text, or image files.

You can select a file in the Navigation pane by clicking it. The Content pane and the Structure pane display information about the selected file. As you select different files in the Navigation pane, each one will be represented in the Content and Structure panes.

The Content pane

The Content pane displays the detailed content of the file selected in the Navigation pane. The editor or viewer used is determined by the file's extension.

File Type Editor(s) or Viewer (s) available in the Content pane
Text files If you select a text file in the Navigation pane (a file with an extension such as .txt or .bat), a single editor, identified by the Source tab, is available in the Content pane. This is a simple text editor that lets you to see and modify the text file.

JBuilder recognizes certain file extensions (such as .txt and .bat) as text files. However, you can extend this list. For more information, see Extending JBuilder's list of text file extensions.

Image files If you select a .GIF, .JPG, or .BMP image file in the Navigation pane, an image viewer, identified by the View tab, is available in the Content pane.
HTML files If you select an HTML file in the Navigation pane, two tabs are displayed at the bottom of the Content pane, labeled View and Source.
View tab
The View tab selects an HTML viewer. This viewer lets you to see the rendered HTML file, as you would see it in a web browser.

Source tab
The Source tab selects an Editor that lets you see and edit the file as raw HTML source.

.Java files If you select a .java file in the Navigation pane, you will see three tabs labeled Source, Doc, and Design.
Source tab
If you select the Source tab when viewing a .java file, you will see the JBuilder Java Source Code Editor. This is a full-featured, syntax-highlighted programming editor, with several popular key mappings.

Doc tab
If you select the Doc tab when viewing a .java file, you will see the corresponding reference doc for that .java file, if there is one. Java supports a documentation standard called JavaDoc that automatically generates HTML documentation pages from .java source code and comments.

JBuilder has produced an enhanced version of JavaDoc, called JBDoc. JBDoc produces HTML files that show additional information about JavaBeans properties, methods and events. JBuilder comes with JavaDoc or JBDoc HTML pages installed for the following:

  • JavaSoft packages (JavaDoc)
  • Borland JBuilder (borland.jbcl) packages (JBDoc)
  • Selected third-party packages

If you click on the Doc tab for any of these provided .java files, you will view the HTML documentation page for the class.

Design tab
If you select the Design tab when viewing a .java file, you will see the JBuilder visual design tools for that class. For example, if you select the WelcomeFrame.java class in the Welcome project (or a Frame class in your own project), you will see the JBuilder UI Designer in the Content pane. This designer will show you what the UI appearance of this class will be at run-time, and lets you visually construct and develop your UI.

You can expand the Content pane to fill the entire AppBrowser window. You simply toggle it in and out of full window mode with the View|Toggle Curtain menu command or with the keyboard accelerator indicated on that menu (Alt+Z key in the default key mapping).

You can also use the mouse to resize the window or any of its panes by dragging the pane boundaries.

See also:
Working with code
Keymapping definitions
Visual design tools
Designing a user interface

The Structure pane

The lower left pane of the AppBrowser shows you a structural analysis of the file that you have selected in the Navigation pane.

For example, if you select a .java file, the Structure pane will show you structural information about the java code in that file, such as

This structural analysis is in the form of a hierarchical tree. You can think of the Structure pane as a table of contents for the file.

Navigating .java files using the Structure pane

Not only does the Structure pane show you the structure of your file, you can also use it as a quick navigation tool to the various structural elements in the file. For example, if you have selected a .java file, you see classes, variables, and methods in the Structure pane. You can then click on any of those elements in the Structure pane and the Content pane will move to and highlight that element in the source code.

This gives you a much faster way to browse and find the elements of a .java file than scrolling through it or searching for a word.

You can also use the Structure pane for drilling down into other ancestor classes and interfaces.

The Component Tree

When you have selected a .java file and then select the Design tab on the Content pane, the Structure pane will display the designable objects in the file, and how they are nested and interrelated. This view is called the Component Tree. For more information, see Using the Component Tree.

See also:
Designing a user interface

Project Browser

The Project Browser mode of the AppBrowser manipulates files in a project. To put the AppBrowser into Project Browser mode, choose the Project tab on the lower left tabset, below the Structure pane. In this mode, the Navigation pane shows the project (.jpr) file and a list of the files in that project.

If you find a file you want to open, select it in the Navigation pane. File details are displayed in the Content pane and file structure is displayed in the Structure pane.

See also:
Creating and managing projects

Directory Browser

If you select the Directory tab below the Structure pane, you will switch the AppBrowser from browsing your project to browsing your file system directory. In this mode, you can browse through directories to locate files.

If you find a file you want to open, select it in the Navigation pane. File details are displayed in the Content pane. File structure is displayed in the Structure pane just as if it were a file in your project.

You can quickly add a file to your project from the Directory Browser by clicking it and dragging it to the Project tab.

Opened Files Browser

The Opened tab gives you a list of your currently active or open files. Your open files are

This list can be thought of as the equivalent of a buffer list used in some editors.

Here are some reasons you will find the Opened Files Browser useful:

Debugger

When you run the JBuilder Debugger, it will add two more tabs to the AppBrowser, Debug and Watch. The Debug tab displays the main Debugger view and the Watch tab displays the Watch view.

While debugging, you can switch to any of the other tabs to review files in your project, browse directories, and look up reference information without disturbing your debugging session or cluttering your screen.

See also:
Using the Debugger

Class Hierarchy Browser

To see the class hierarchy for a particular .java file, select it in the Navigation pane, right-click, and from the context menu choose Class Hierarchy. This will add a new AppBrowser tab for Class Hierarchy viewing. When you click on this tab, the Navigation pane will show you the inheritance tree for your file. You can then navigate to any file in the inheritance tree by selecting it in the Navigation pane.

Search Results Browser

If you use Search|Search Source Path to look for a search string across directories, JBuilder adds a Search Results tab to the AppBrowser. When you click this tab, you will see a list of the file(s) that contain the selected text.

See also:
Searching for text across files in a selected path or paths

Drilling down into other classes and interfaces

Often you will need to look at .java files that are not part of your project, but which are referred to in the class you are editing. This might be an ancestor class or the class of some instance variable.

There are several traditional ways you can navigate to the file you need. If you know its full package and class name, you can

With the Structure pane, JBuilder provides a much faster way. To see the .java file for an ancestor class, an interface, or the type of a variable shown in the Structure pane, just double-click it. The AppBrowser will go to that file, showing it in all three panes.

Follow these steps for an example of drilling down:

  1. Use Help|Welcome Project to open the Welcome Project.
  2. Select WelcomeFrame.java in the Navigation pane.
    In the Structure pane, note that WelcomeFrame extends DecoratedFrame.
  3. Double-click DecoratedFrame in the Structure pane.
    The AppBrowser will show you DecoratedFrame.
  4. Double-click Frame to drill down another level into the Frame parent class of DecoratedFrame. Note that you can not only see the source of the Frame class, but you can also click on the Doc tab and read the reference doc for the class as well.
If you navigate to a file for which no source code is found, JBuilder will synthesize a temporary source file to show in the Source pane. This temporary file contains method stubs for the public methods.

The temporary stub file displays method signatures for public methods and comments indicating that no implementation information is available. A Doc tab is also displayed that shows the reference HTML doc for the class.

The stub source is only generated temporarily in memory, and it is not saved to disk.

Using Home, Prior, and Next buttons

JBuilder provides Home, Prior, and Next buttons above the Navigation pane that you can use to traverse the history list of files that you have drilled down into.


Button Description

Moves to beginning of AppBrowser list
Moves to prior item in AppBrowser list
Moves to next item in AppBrowser list

Adding reference classes to Opened Files

If you need to frequently refer to a file that you have found using drill-down or any other navigation method, you can drag it from the Navigation pane to the Opened tab, to put it into your Opened Files Browser where you can quickly look at it again later.

Browse Symbol at Cursor

In addition to drilling down into ancestor or variable classes in the Structure pane, you can also use the context menu in the Source view of a .java file to browse to a symbol in the source.
  1. Place your cursor on the symbol (interface or class name) in the source.
  2. Right-click.
  3. Choose Browse Symbol at Cursor.
    JBuilder will locate the file for that java class or interface and show it in the AppBrowser.

Removing tabs from the AppBrowser

To remove a tab, such as Search Results or Class Hierarchy, that has been added to the AppBrowser,
  1. Right-click it.
  2. Choose the Drop command for the name of the tab you want to drop.
    JBuilder removes the tab.

Extending JBuilder's list of text file extensions

JBuilder recognizes certain file extensions as being text files in the AppBrowser. If you find that you need to treat some other file extension as a text file type, you can extend JBuilder's list.

To define which files types to treat as text files,

  1. Choose Tools|Treat As Text.
    The Treat As Text dialog is displayed.
  2. Enter the extension of the file type you want to edit as text.
    You can enter the extension in any one of the following formats: xxx, .xxx or *.xxx.
  3. Press Enter or Add.
  4. To remove a file type, select it and click Remove.
  5. Click OK when you're done.
You can now choose File|Open/Create to open files of the selected type. When you choose the file in the Navigation pane, its contents are displayed in the Content pane, ready for editing. When you choose File|Save to save the file, JBuilder automatically saves the changes to the correct format.


The Object Gallery

The Object Gallery contains shortcuts that create skeletal instances of many objects. To display the Object Gallery, choose File|New. To use a shortcut or template, click on the icon. JBuilder creates the skeletal code in a .java file and adds the file to your project.

To add your own files to the Object Gallery,

  1. Select the page of the Object Gallery on which you want the file to appear.
  2. Right-click and choose Add Snippet.
    The Add Snippets dialog is displayed.
  3. In the Object Gallery description field, enter a brief description of the snippet.
  4. Specify the name of the snippet file.
  5. Specify the name of the image to display in the Object Gallery and click OK.
See the example snippets file in the snippets directory for advanced options.


Wizards

To guide you through the major tasks necessary to create robust Java programs, JBuilder comes equipped with wizards. These are tools that guide you through the necessary steps for a specific function or task.

File wizards, wizards that create new files, are available from the File|New menu command. Utility wizards, wizards that modify existing files, are available on the Wizards menu. In keeping with JBuilder's extensible design, the list of wizards is expandable so that you can add new wizards as they become available.

The following table presents an overview of the wizards. For more information on a specific wizard tool, display the wizard and click the Help button.

File wizards

Wizard Description

Project wizard Guides you through the housekeeping tasks of project creation and provides a simple, automated method for creating a new Java development project. If you invoke any of the other File wizards when you don't have a project open, the Project wizard will automatically be invoked first.
Application wizard Creates a new Java application shell which contains a Frame.
Applet wizard Creates a minimal applet and HTML file which contains the applet.
New Frame wizard Creates a new frame.
New Dialog wizard Creates a new dialog.
New Panel wizard Creates a new panel.
New DataModule wizard Creates a new data module.
New Java File wizard Creates a new class.
HTML wizard Creates an HTML file. (Does not have a user interface.)

Utility wizards

Wizard Description

Override Methods wizard Creates skeletal code to override a method in a superclass.
Implement Interface wizard Creates skeletal code that tells other objects that the selected class can be accessed via a certain Java interface.
Resource wizard Bundles resources into separate classes to enable localization.
Interaction wizard Connects events to components.
Deployment wizard Creates a .jar or .zip archive file of all the specified project files.
Create Applet Wrapper wizard Turns an applet into a JavaBean.

See also:
Automatic code generation with wizards