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
Describes what you see when you open JBuilder.
- The main window
Describes the parts of JBuilder's main window, including the menu bar, the tool bar, and the Component Palette.
- The AppBrowser
Describes the AppBrowser and the AppBrowser modes, including the Project Browser mode, the Opened Files Browser mode, and the Directory Browser mode. Describes the AppBrowser's Navigation pane, Content pane, and Structure pane. Explains how to navigate your .java file and drill down into ancestor classes.
- The Object Gallery
Describes the Object Gallery, a repository of shortcuts that create skeletal instances of many objects.
- Wizards
Provides a brief description what each wizard accomplishes.
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,
- Save your files, and select File|Exit.
- Delete or archive the file bin\jbuilder.ini.
- 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 is where you choose menu commands.
- The toolbar displays buttons that are shortcuts for commonly performed tasks, such as opening and saving a project; creating a new application; building, compiling and debugging; undoing an action; and searching and replacing text. Place the mouse pointer over the toolbar buttons, without clicking, to see the flyover labels of the buttons.
- The Component Palette displays components available in the JBuilder component library. See Components delivered on the Palette for more information.
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 tabs below the Structure pane control which mode the browser is in (what kind of browser it is). Examples are Project Browser mode (Project tab), Opened Files Browser mode (Opened tab), and Directory Browser mode (Directory tab).
- The tabs below the Content pane control the kind of viewer or editor used in the Content pane. Examples are the Editor (Source tab), the UI Designer (Design tab), and Documentation Viewer (Doc tab). Other available viewing modes of the Content pane are HTML Browser (View tab) and Image Viewer (Viewer tab).
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
- Imported packages.
- The classes and/or interfaces in the file.
- Any ancestor classes and/or interfaces.
- Variables and methods.
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
- Files you have edited in this AppBrowser session.
- Files you have explicitly dropped onto the Opened tab from the Directory or Project tabs.
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:
- Your java projects may eventually contain many files. In any editing session, you may be particularly interested in only a few of these files. Once you have edited them, or explicitly dropped them on the Opened tab, you can see your short list of working files more easily.
- You may need to look frequently at the source or javadoc for some file or files that are not part of your project. You can find them in the Directory Browser mode, and then drop them onto the Opened tab so that you can quickly refer to them again.
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
- Open it in a separate browser (File|Open/Create)
- Browse for it using Search|Browse Symbol
- Use the Directory Browser to look for it on the disk
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:
- Use Help|Welcome Project to open the Welcome Project.
- Select WelcomeFrame.java in the Navigation pane.
In the Structure pane, note that WelcomeFrame extends DecoratedFrame.
- Double-click DecoratedFrame in the Structure pane.
The AppBrowser will show you DecoratedFrame.
- 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.
- Place your cursor on the symbol (interface or class name) in the source.
- Right-click.
- 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,
- Right-click it.
- 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,
- Choose Tools|Treat As Text.
The Treat As Text dialog is displayed.
- 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.
- Press Enter or Add.
- To remove a file type, select it and click Remove.
- 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.
- The New page contains shortcuts for creating applications, applets, projects, frames, dialogs, panels, data modules, classes and HTML files. See Automatic code generation with wizards for more information.
- The Panels page contains shortcuts for creating a
- Tabbed Pages panel, a multi-paged dialog box with three tabbed pages
- Dual list box with a Source and Destination list
- The Menus page contains a shortcut for creating a standard menu, which includes a File, Edit and Help menu. Each menu contains standard menu items.
- The Dialogs page contains shortcuts for creating
- An About Box
- Two standard dialogs, each with a BevelPanel and an OK and Cancel button
- A Password dialog
- The DataModule page contains a shortcut for creating an employee database.
- The Other page contains a shortcut for creating an example snippet.
To add your own files to the Object Gallery,
- Select the page of the Object Gallery on which you want the file to appear.
- Right-click and choose Add Snippet.
The Add Snippets dialog is displayed.
- In the Object Gallery description field, enter a brief description of the snippet.
- Specify the name of the snippet file.
- 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
See also:
Automatic code generation with wizards