Working with applets 4 Complete the three-step wizard to create the applet. The applet is added to the project. For more information on deploying applets, see Deploying Java programs in Building Applications with JBuilder. Automating application development 5-15
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services
Working with applets For more information, see Creating JavaBeans with BeansExpress in Building Applications with JBuilder. Working with applets Applets are Java programs that are stored on Internet/intranet web servers. Unlike applications, applets are not stand-alone programs but require a viewer to run, such as a web browser. Applets must be launched from an HTML web page that includes an APPLET tag. Before developing applets, it s important to fully understand browser and JDK compatibility issues. See Working with applets in Building Applications with JBuilder and Chapter 17, Building an applet for information on these issues. Using the Applet wizard JBuilder provides an Applet wizard to assist you in creating applets. The Applet wizard creates an applet consisting of two files and adds them to the existing project: An HTML file containing an APPLET tag referencing your applet class. This is the file you should select to run or debug your applet. A Java class that extends JApplet or Applet. This is your main UI container to which you ll add UI components using the UI designer. To open the Applet wizard, 1 Close all open projects. 2 Choose File|New. Double-click the Applet icon in the object gallery. The Project wizard opens first. You must create a project before creating an applet. 3 Complete the three steps of the Project wizard. The Applet wizard opens. 5-14 Learning Java with JBuilder
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services
Creating JavaBeans Creating JavaBeans This is a feature of JBuilder Professional and Enterprise. A JavaBean is a collection of one or more Java classes that serves as a self-contained, reusable component. A JavaBean can be a discrete component used in building a user interface or a non-UI component such as a data module or computation engine. At its simplest, a JavaBean is a public Java class that has a constructor with no parameters. JavaBeans usually have properties, methods, and events that follow certain naming conventions. JavaBeans have some unique advantages over other components, such as: They are pure Java, cross-platform components. You can install them on the JBuilder component palette and use them in the construction and design of your program, or they can be used in other application builder tools for Java. They can be deployed in JAR files. JBuilder s BeansExpress, available in Professional and Enterprise, is the fastest way to create JavaBeans. It consists of a set of wizards, visual designers, and code samples that help you build JavaBeans rapidly and easily. Once you have a JavaBean, you can use BeansExpress to make changes to it. Or you can take an existing Java class and turn it into a JavaBean. To access JBuilder s JavaBean wizard to start creating a JavaBean, 1 Choose File|New Project and create a new project with the Project wizard. 2 Choose File|New to display the object gallery. 3 Double-click the JavaBean icon on the New page of the object gallery to open the JavaBean wizard. Automating application development 5-13
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services
Working with projects Working with multiple projects When working with multiple projects, you can open them in one instance of the AppBrowser or in different instances. All open projects are available from any open AppBrowser instance. However, you can only view the files of one project at a time in each AppBrowser instance. There are several ways to switch between multiple open projects and files: Select the project from the drop-down list on the project toolbar. Select the file from the list of open files in the Window menu. You can also instantiate another AppBrowser or switch between open AppBrowsers from the Window menu. For more information, see Creating and managing projects in Building Applications with JBuilder. 5-12 Learning Java with JBuilder
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services
Working with projects The Add Files/Packages dialog has two tabs: Packages, which shows a list of available packages, and Explorer, which allows you to browse your directories and files. Tip You can create a new file from the Explorer page by entering a new file name and clicking OK. You will get a message asking if you want to create that file; click OK. Saving and closing projects To save a project, select File|Save All, File|Save Current Project, or click the Save All button on the main toolbar. To close a project, select File|Close Project, File|Close Files, or click the Close Project button on the project toolbar. Renaming projects and files To rename a project, 1 Select the project in the project pane. 2 Select Project|Rename. 3 Enter the new name in the File Name field of the Rename dialog box. 4 Click OK. To rename an open file, 1 Select File|Rename or right-click on the file tab at the top of the content pane and select Rename. 2 Enter the new name in the File Name field of the Rename dialog box. 3 Click Save. Caution Renaming projects and files does not change the references to the relevant package and file names inside the code. You must make those changes separately. Automating application development 5-11
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
Working with projects You can also globally set the default properties for all new projects in the Default Project Properties dialog box (Project|Default Project Properties). For more information, see the Setting project properties topic in Creating and managing projects in Building Applications with JBuilder. Managing projects From the AppBrowser, you can: View project files. Open and edit multiple files and projects, including paths and names. Add source files and packages to a project. Add project folders. Navigate through packages. Browse HTML files and web graphics. Drill down into the structure of classes, methods, and code elements. Opening projects To open a project, select File|Open Project and browse to find the project file you want. To open a previously opened project, select File|Reopen and select the project file from the drop-down list. Or click the Open or Reopen buttons on the main toolbar. Adding and removing files You can add and remove files and packages from a project or folder by using the Add Files/Packages or the Remove From Project buttons on the project toolbar, or by right-clicking on a file in the project pane and selecting Add Files/Packages or Remove From Project from the right-click menu. 5-10 Learning Java with JBuilder
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
Working with projects Setting project properties Project properties control the following: Paths: output path, source path, backup path, JDK version (in JBuilder Professional and Enterprise), and libraries paths. General properties: encoding, automatic source package enabling, and JavaDoc fields. Running. Debugging. Building. Code style. These are features of EJB and JSP handling. Enterprise edition Version control. Note The project properties options vary by JBuilder edition. You can set the properties for your project by right-clicking a .jpr or .jpx project file in the project pane and then selecting Properties or by choosing Project|Project Properties. On the Paths page of the Project Properties dialog box you can specify: The version of the JDK to use for compiling and running. (JBuilder Professional and Enterprise) Where the compiler should search for source files and place class files. The libraries to use. The backup path. Automating application development 5-9
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
Working with projects To view your project notes information as JavaDoc class fields, select the General tab in the same dialog. For more information on projects and the Project wizard, see Creating and managing projects in Building Applications with JBuilder. For a tutorial on creating a project and an application, see Chapter 16, Building an application. Displaying project files JBuilder displays the project file in the project pane of the AppBrowser. The files that make up the project are listed below it. To open a file in the content pane, double-click its name in the project pane. Note You can only view one file at a time in the content pane. To view multiple files simultaneously, open multiple instances of the AppBrowser. To do so, select Window|New Browser for each instance desired. A tab with the file name appears at the top of the content pane. If several files are open, there will be a file tab for each one. You can look at a different open file by selecting its file tab or by selecting the file from the Window menu. You can customize the labeling and positioning of the file tabs. To learn about customizing your file tabs, see the File Tabs topic in The JBuilder Environment in Building Applications with JBuilder. The following figure shows a project file, hello.jpr, in the project pane with the source and image files listed below it. The project notes file, hello.html, is selected in the content pane. The project notes are created from the information entered in Step 3 of the Project wizard. 5-8 Learning Java with JBuilder
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
Working with projects 1 Notice the project, source, backup, and output paths. The information that you set in Step 1 shows up here. JBuilder defaults all of these paths to the jbproject directory, but you can change them here to suit your development needs. 2 Set the version of the JDK that you will compile against. Click on the ellipsis (…) to bring up the Select A JDK dialog. 3 Choose the libraries the project will require. Click Add to bring up the Select One Or More Libraries dialog. This dialog allows you to sort the library list, select single or multiple libraries, create new libraries, and edit or delete existing libraries. 4 Decide whether you want a project notes file. If not, uncheck this box and click Finish. You re done! If so, leave the box checked and click Next in order to create this file. Step 3 of the Project wizard appears. Project Wizard: Step 3 Step 3 develops the project notes file. These project notes are the basis of the About box of the application you create. 1 Enter the project s title, author or authors, and company name. Write a project description in the pane below. 2 Click Finish. You re done! The newly created project node appears at the top of the project pane with the HTML notes file below it. To view your paths, JDK, and libraries, right-click on the project node, select Properties, and select the Paths tab. Automating application development 5-7
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services
Working with projects 1 Enter the project name. 2 Select the project file type: .jpr or .jpx. To read about file types in JBuilder, see File types in a JBuilder project in Creating and Managing Projects in Building Applications with JBuilder. 3 Choose a project template. You can choose from the drop-down list of previously opened projects, or you can click the ellipsis (…) to browse to a project you want to use as a template. Note You can add files at any time by selecting the Add Files/Packages icon from the project toolbar. 4 Set the root path. You may choose from the drop-down list or click the ellipsis to browse. 5 Enter the name of the project directory. 6 If you don t wish to accept the default names, set the names of the source directory, the backup directory, and the output directory. 7 Choose whether you want the project directory to be the parent to the source and output directories. If you leave this unchecked, JBuilder will automatically put the project and class files into separate directories off of the root path. You can edit your paths later in the wizard. 8 Click Next. Step 2 of the Project wizard appears. Project Wizard: Step 2 Step 2 sets the paths the project will use, the JDK version to compile against, and the libraries the project will require. Step 2 is where you can tell JBuilder whether to make a project notes file. 5-6 Learning Java with JBuilder
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services