Forte for Java Development Guide

zhaozj2021-02-17  76

Forte for Java Introduction Forte for Java, Community Version is a Java Integration Development Environment (IDE) written in Java language. It is a cross-platform development tool with the ability to develop clients and server applications. Forte fully utilizes the powerful features of Java languages, providing you with a dynamic, alarm development environment. It can be obtained from: java.sun.com. Features of Forte for Java: Module: Forte for Java is a structured system. The features of the IDE such as editing, debugging, GUI generating, EJB (Enterprise Java bean) are all independent modules. Forte for Java's Update Center can help you download the latest modules from Sun's official website. Deliveability: Forte for Java is well configurable, and users can easily change the graphical user interface, configuring the menu, toolbar, workspace, etc., can generate a graphical user interface with the user's own development style. Demonstration: Forte for Java provides a complete set of open API sets (Forte itself is developed by this API), so it is possible to take advantage of this mature development platform regardless of the version of FORTE. Integrated Development Environment (IDE) Introduction In this section, we will briefly introduce some of the main components and their characteristics of the IDE user interface. Make the readers who use Forte for Java for application development to learn how to browse and find commands, how to get basic knowledge such as helping documents. User Interface: User Interface by Main Window, Explorer (Explorer), Editor, Project Settings Window, Global Options Windows (Global Selection Form) Several core parts consists. We will introduce them one by one below. 1 Main window Once Forte For Java starts running, the main form is opened and keeps the FORTE end run. The main form can be considered a control center for the entire integrated development environment, and most important operations and commands are related to it. It can be divided into four sets of independent control groups: menu bar, toolbar, work area, and status bar. The menu column consists of nine menus, which is consistent with the Windows98 operating style, respectively, Edit (edit), View, Project, Build (Created), Debug (Debug), Tools (Tool) , Windows, Help. The toolbar is located in the middle of the main form, consists of some operation buttons, respectively corresponds to the functionality of some menu options or commands, respectively. You can use the mouse to click these buttons to complete the specified features. The toolbar button makes the user's operational process greatly and simplifies and allows the operation process to be visualized. The toolbar button is more special is Component Palette, which is located in the right half of the toolbar. It is mainly combined with the Form Editor (Form Editor) to perform visualization. It consists of some standard components and page layouts.

The menus and tools are related to context, which is sometimes unavailable (in gray display) because there is no activation with the form or object associated with them. Workspaces: Forte for Java introduces the concept of workspace to manage forms and tools. The work area is located at the lower end of the main form, there are five tabs: Editing, GUI Editing, Browsing, Running, Debugging. Each tab has a set of forms corresponding to the application development process. Under the default condition, the IDE automatically opens the GUI Editing workspace when the user opens a visual form, and when the user runs an application, the IDE automatically switches to the Running workspace. 1.2 Explorer: Forte for Java Provider provides users with an interface to manage all objects and files and an entry that enters various programming functions. The user can connect various data sources by using it to edit the class, manage items, changing the object properties. 1.3 Form Editor: The Form Editor provides the user with the functionality of visual development user interface. Users can select a variety of standard components from the Component Palette, such as menus, scroll bars, buttons, etc., then place them directly on the Form Editor, Forte for Java automatically generates the design and property settings of the corresponding Java code completion components (Java The code can be seen from Editor WinDOW). The form editor can also change the appearance of the various components on the form by calling Java Layout Explorer to generate user-defined interfaces. 1.4 Project Settings Window (Project Settings Form) and Global Options Windows: These two forms are responsible for configuring IDE. Project Settings Window manages related settings for a single project, such as the type of compiler, Java resource, etc. Global Options Windows is configured for the entire IDE integrated development environment. User Manual, Context Help and Tool Tips: Forte For Java provides three ways to get help information 2.1 User's Manual: Select Help | Document | User's Guide from the main menu, enter the User Manual. The Java Help reader is divided into two parts, lists the directory and title on the left, and the contents of the selected title are displayed. Users can also search for themselves from the entire user manual through search engines. 2.2 Context Help: Users can use a more convenient way to get online help, use a mouse to select a form, dialog, icon, etc., then press the "F1" button to obtain the properties of the component, for Menu option, you can place the mouse pointer above the option and press the "F1" button. 2.3 Tool Tips: When the user puts the mouse pointer to a part of the IDE integration environment, a text bar will appear, and its content is a brief introduction to the part. This feature is useful for understanding a node of the tree structure or a separate attribute in the property table. Finally, users can browse the user manual in the HTML format with an external browser (IE or NC).

The specific path is as follows: DOC / COM / NETBeans / Developer / modules / userguide / usergdto.htm ******************************************* **** This article briefly describes how to develop and perform Java applications in Forte for Java. 1. Creating a new class In Forte for Java, users can create classes and other objects through templates, forming a basic framework of classes, and providing some basic code for classes. Of course, if the user is willing to write all the code, he can create an empty template. The following three basic creating objects: Create objects from Main Window: Select File | New from Template from Main Menu; Expand the node in the template wizard, then select a template, then the right panel of the dialog The corresponding description of this template will appear; press the "Next" button to enter the TARGET Location page of the template; enter the name of the object you want to create in the "Name" field, be careful not to enter a file suffix, because the system will automatically add a suffix to the suffix The name is after the name. On the same page, select a package for your own class, you can enter the name of the package in the "package" domain, or you can select a package from the tree structure below. Press "Finish" to exit the wizard while generating a class. Note: When you create an object through the template, the system will prompt you to add a file to the current project. If you select "Yes", the new file will be displayed together in the FileSystems and Projects tab. If you select "NO", the new file will not be displayed in the Issue. If you select "ALWAYS", this new class and its subclass will be automatically added to the current project. If you select "Never", all of these classes will not be added to the current project. Create an object from Explorer: If Explorer is not open, select File | Open Explorer from the main menu, or select "Open Explorer" from the toolbar. Click the "FileSystems" tab in Explorer, select the package you want to place (in the form of a folder), then click the right mouse button to pop up the floating menu. Select "New from Template" from the floating menu and then other steps. Create an object from Object Browser: Click the "Browsing" tab of the main form to open the Object Browser, or select File | Object Browser from the main menu. On the Object Browser's Projects panel, select the package (packet) you want to place, click the right mouse button to pop up the floating menu. Select "New from Template" from the floating menu and then other steps. Once you have created a class, Editor Window will open, and the skeleton code of the already generated class is displayed. If you generate a visual form from the template, the FORM WINDOW (Form SMS) and the Component Inspector will also open.

The newly created class will be automatically added to the tree structure of Explorer and in Object Browser. Now you can edit new classes directly in Editor Window, or generate various elements, such as methods, structures, and variables, and more by customized dialog boxes. Note: Unlike other IDE development environments, Forte for Java is not based on projects to develop applications. All objects developed by the IDE integrated environment, as well as other file systems connected to IDE, can manage and process through the Object Browser or Explorer (Explorer). Of course, all files can also be organized in the form of a project, making compilation and execution operations, and you can save your own project settings for each item. 2. Compile Java Source: Forte for Java provides a rich compilation selection, from different ways to activate the compile command to a different compiler for each class. Note: When you select Compile (including Compile All, Compile Project, Build, Build All, or Build Project) command, IDE will automatically compile the first file and package that it is found to be identical to compile file name. . Therefore, if you have two files and packages in Explorer and the package in the same level, even if you are in the second package to select the compile command, the system will automatically compile the files in the first package. Compile Single Class: You can compile objects in the active Editor Window, or you can select an object from the Explorer (Explorer) to compile. The following four ways can be completed: Select Build | Compile from the main menu; click the Compile icon in the toolbar; press the "F9" key; select the object to compile in Explorer, click the mouse Right-click, select "Compile" from the pop-up menu. Compile Package: Compile packages to make multiple options, you can get from the "Build" menu, toolbar, and Explorer's pop-up menu from the menu bar. Select "Compile" option, all source programs in the file will be compiled, or when they are compiled, otherwise only compile the previous compiled file; select "Compile All" option, folder and it The source program in all subfolders will be compiled; select the "Build" option to compile all the source programs, regardless of whether they have been modified. This approach allows you to determine that all files have been compiled; select the "build all" option: Take the build folder and all its subfolders. Delete the .CLASS suffix file: The Build menu contains the Clean and Clean All options to delete the compiled class. The Clean option deletes all the .class suffixes of the selected package; the Clean All option deletes all the .class suffixes of the package and their subcles. Built-in compiler support: IDE Integration Environment Support and Javac Two compilers, IDE puts Fast Javac as the default compiler. Fast Javac is a natural compiler that has different versions of each medium development platform, and the final compilation result is the same Java binary code.

It provides a relatively fast compilation scheme for developers who develop applications on a platform. Fast Javac is currently supporting Solaris, Linux, and Windows platforms. Javac is a cross-platform compiler written in Java language. Change the default compiler type: IDE provides the default compiler method, once you change the default compiler, you will affect all classes and templates that have not specified compilers yet. The specific implementation steps are as follows: From the main menu, select Project | Settings ..., open the Project Settings Form; select the Java Sources node in the left panel of the form; select Default Compiler Type (Default Compiler Type) Attribute, select a new compiler type from the drop-down menu. Change class compiler type: Each class has a default compiler. If you want to compile a class with different compilers or different configurations of the same compiler, you can customize class properties. Select an object from the FileSystems (File Systems) tab of Explorer; select View | Properties from the main menu; click the execution tab of the Properties form; double click the Compiler button to roll the lookup The compiler type, or click the Compiler property field, select the compiler type from the drop-down menu. Tips: If you want to change a series of compiler types, you can press and hold the Ctrl key while selecting the class and then change the compiler type in the property table. 3. Run the Java class: Java applications can have multiple implementations. First, you must determine that the Java object is executable (if there is a Main () method, or the subclass of the Applet or Japplet. Then, click the right mouse button in Explorer and select the Execute option from the pop-up menu. You can also from Editor (Editor) The object is selected in the form, then select Build | Execute from the main menu; select the execute icon from the toolbar; use the shortcut key Ctrl F9. Once the start is started, the Java class will first compile (default) Next). After the compilation is successful, IDE will switch to the Running workspace. Execute the type and actuator: You can use the internal or external rule-run typical Java application, these two methods have their own advantages. And disadvantages. Java Applets can run in the Applet Execution, and other implementations can be installed by extended module. External execution: Most applications use external execution methods, this way is set to most templates for the default execution of most templates Way. During the external execution of the application, a new VM (virtual machine) is activated so that you can run applications that require special VMs, as well as some internal execution methods (will be described below) unautreal Operation. You can specify the executable VM (such as java.exe), as well as the path settings of the command line parameters and classes after the command. External execution provides a protection for application crashes and delays. Internal (linear) Execution: An application is run in the Forte for Java IDE integration environment called internal execution. This allows the application to modify the IDE itself directly and can improve the loading speed of the application.

But the disadvantage of this is that the application cannot install your URLStreamHandlerFactory or the SecurityManager object (if you can't run the RMI application). When executed inside, if the application crashes, the IDE environment has collapsed. Note: There are some applications such as Startup Routines (in the Startup folder, you can use Tools | Global Options from the main menu), requiring internal execution, because the purpose of these programs is to modify the IDE environment itself. Other Implementation Types: There are also some execution types to be customized for special application types such as RMI and JSP applications. 4. Debuging the Java class debugger can be considered as "snapshot" when the system is in the execution state. By setting breakpoints in the key position of the source code, the debugger can abort the execution in these places, display the environment details at the breakpoint; you can enter the interior of the code, monitor the execution; you can even connect the debugger to a run run the process of. Debugger form: The Debugger Form contains three tabs, Breakpoints, Threads, and Watchs (viewing windows). Breakpoints: The BreakPoints tab lists all the breakpoints of all current settings, the name of the name, and the line where the breakpoint is located. Add a breakpoint in your code: Locate the cursor on the line you want to add; select the Add / Remove BreakPoint option from the Debug (Debug) menu; or click the right mouse button on the row, select Add from the pop-up menu. / Remove breakpoint; or use shortcut Ctrl F8. After the breakpoint is set, the current row will be displayed in highlighted blue. BreakPoint Optional Settings: If you choose the "New BreakPoint" command when you break points, in the pop-up Add Breakpoint dialog box, you can have the following selection: if you want to execute When you go to the breakpoint, there is a prompt in the Output form, you can select the "Print Text" option; you can also use your own text to cooperate with the self-explanation code provided by the system {lineenumber} (number of lines), { ClassName} (class name), {threadname} (thread name) to further set the contents in the prompt. You can also set these configurations in the DEBUGER form. Eliminate breakpoints: In the Editor form, position the cursor to eliminate the breakpoint; select the debug | add / remove breakpoint option from the main menu; or use shortcut Ctrl F8. ******************* Develop Java Server Page (JSP) Forte for Java, a series of functions for developing Java Server Page (JSP): Create, Edit , Compile, run. 1. Create and edit Java Server Pages Create a new JSP file: Select File File | New from Template from the main menu.

Expand the JSP_SERVLET folder in the Create Template Wizard, select "Next" after selecting JSP. Select the name and folder (package) for your JSP file in the next wizard, then press "Finish" to end. Edit a JSP file: Double-click the file you want to edit in the Explorer, the editor form will appear, then you can enter your own JSP code in your editor. 2. Compile JSP When you edit your JSP file, you can compile it into a class file. The compilation process is divided into two steps: first convert the JSP page into a servlet and then compile the servlet into class file. Compile a JSP: Select the JSP file you want to compile in the Explorer or Object Browser, click the right mouse button, select "Compile" from the float menu. Compilation error handling: Any errors that appear during the compilation process are displayed in the compiler output form. If the first step conversion servlet is successful, the user can better analyze the errors in the second step by viewing the servlet source code. The user can select a JSP file at this time, click the right button, select "View Servlet" from the floating menu, and the SERVLET code is displayed in the editing form. Once you find an error, you can modify it in the JSP page. Select the compiler: Users can choose different compilers depending on the needs, such as selecting the servlet compiler in the "Execution" column, compile the servlet into a class in the file properties. In the compilation process, you contain Java Beans, other JSP pages, error handling pages: If the user is called in the compiled JSP page (by tag ), the called Beans will be used with the current JSP page. Compilation. Similarly, if the user's JSP page references other JSP pages (by tag or ), the referenced JSP page will also be compiled. If the user uses an error handling page (by specifying <% @ page erorpage%>), the error handling page will also be compiled together. Note: This version of the Forte for Java supports JSP specifications 1.0. The server built-in for debugging and running the JSP page is Sun JavaServer Web Development kit 1.0.1.3. Executing JSP After successfully compiles your JSP page, you can run your JSP engine with Forte for Java. JSP page. Perform a JSP page: Select the JSP file to be run from the resource manager or the object browser, click the right mouse button, select "Execute". The Servlet and JSP engine start running, and the JSP page will be displayed in the web browser. Specify parameter queue: Users can specify a series of parameters to pass through the submitted form to the server. In the "Execute" section of the page property sheet, edit the request parameters attribute. Note Please use the standard request string symbol (? Parameter 1 = value 1 & parameter 2 = value 2). Restart the server: When you execute a JSP page multiple times, the server does not restart, and it is to be tolerated is that every server loads a new page, saving the startup time of the JSP page. However, all classes called on the JSP page are not reloaded. Therefore, if you modify the JAVA bean in the JSP page you must restart the server.

In the Resource Manager or the Object Browser, select the JSP node, click the right mouse button, select "Execute (Restart Server" from the pop-up menu. Configuring JSP Execution Types: Sometimes users want to change the configuration of the server to get a better execution environment, all attributes in the Forte for Java's JSP Execute property table can be accessed. Get JSP Properties: Select the JSP file node in the Explorer, select the VIEW | Properties of the main menu to open the properties form. In the Properties Form, select the "Execute" section, click the "Executeor" property, select the "..." button. At this time, the "Executeor" property editor appears, all attributes in the JSP Execute property are displayed in the editor. Users can display the JSP page without the Built-in browser built-in browser. Select E (New from Template) from the main menu. Expand the JSP_SERVLET folder in the Create Template Wizard, select "Next" after selecting JSP. Select the name and folder (package) for your JSP file in the next wizard, then press "Finish" to end. Edit a JSP file: Double-click the file you want to edit in the Explorer, the editor form will appear, then you can enter your own JSP code in your editor. 2. Compile JSP When you edit your JSP file, you can compile it into a class file. The compilation process is divided into two steps: first convert the JSP page into a servlet and then compile the servlet into class file. Compile a JSP: Select the JSP file you want to compile in the Explorer or Object Browser, click the right mouse button, select "Compile" from the float menu. Compilation error handling: Any errors that appear during the compilation process are displayed in the compiler output form. If the first step conversion servlet is successful, the user can better analyze the errors in the second step by viewing the servlet source code. The user can select a JSP file at this time, click the right button, select "View Servlet" from the floating menu, and the SERVLET code is displayed in the editing form. Once you find an error, you can modify it in the JSP page. Select the compiler: Users can choose different compilers depending on the needs, such as selecting the servlet compiler in the "Execution" column, compile the servlet into a class in the file properties. In the compilation process, Java Beans, other JSP pages, error handling pages: If the user is compiled, the JavaBeans component (by tag ), called B # Eeeeeeee>