Deployment in Forte


Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Chapter 15.  JavaBeans

Every GUI tool has its own procedure for deploying JavaBeans in their environment. Their processes do resemble each other to a degree, so we will show you how to deploy the ProgressBar Bean in the Forte development environment. To install the ProgressBar example in the Forte environment, follow this procedure:

  1. Open the Forte IDE.

  2. Select Tools, Install New JavaBean. The dialog shown here in Figure 15.6 will appear:

    Figure 15.6. The Install JavaBean dialog enables you to specify the location of the .jar file that holds your Bean.


  3. Move to the directory where you created the .jar file, select the ProgressBar.jar file, and click OK. This will open the Select JavaBean dialog that is shown in Figure 15.7:

    Figure 15.7. The Select JavaBean dialog enables you to specify the Bean that you want to install.


  4. A single .jar file can contain more than one JavaBean. Select the ProgressBar and click OK. This will open thePalette Category Dialog Box shown in Figure 15.8:

    Figure 15.8. The Palette Category dialog enables you to specify the palette in which your Bean will reside.


  5. Select the Swing(Other) Palette and select OK. The ProgressBar's icon is now in the Swing(Other) palette, as shown in Figure 15.9:

    Figure 15.9. The Swing(Other) palette now contains the ProgressBar Bean.


  6. To use this Bean, it is necessary to create a class. Choose File, New, and then Frame. Name the new class TestProgressBar.

  7. Choose the GUI Editing tab and add a JPanel to the frame from the Swing palette. This will give the ProgressBar a container.

  8. Go to the Swing(Other) palette and click the ProgressBar icon.

  9. Now click the panel and see the ProgressBar appear as shown in Figure 15.10:

    Figure 15.10. . The TestProgressBar application now contains an instance of the ProgressBar.


If we look at the code generated by this process you will see an instance of the Progress bar in the application as shown here in Listing 15.3:

Listing 15.3 The File
 /*   *   * Created on August 27, 2002, 4:17 PM   */  /**   *   * @author  Stephen Potts    */  public class Form1 extends javax.swing.JFrame  {      /** Creates new form Form1 */      public Form1()      {          initComponents();      }      /** This method is called from within the constructor to       * initialize the form.       * WARNING: Do NOT modify this code. The content of this method is       * always regenerated by the Form Editor.       */      private void initComponents()      {          jPanel1 = new javax.swing.JPanel();          progressBar1 = new com.samspublishing.jpp.ch15.ProgressBar();          addWindowListener(new java.awt.event.WindowAdapter()          {              public void windowClosing(java.awt.event.WindowEvent evt)              {                  exitForm(evt);              }          });          jPanel1.add(progressBar1);          getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);           pack();      }      /** Exit the Application */      private void exitForm(java.awt.event.WindowEvent evt)      {          System.exit(0);      }      /**       * @param args the command line arguments       */      public static void main(String args[])      {          new Form1().show();      }      // Variables declaration - do not modify       private javax.swing.JPanel jPanel1;      private com.samspublishing.jpp.ch15.ProgressBar progressBar1;      // End of variables declaration  } 

This is a good example of how visual programming works. We were able to create a simple application in Forte that used a progress bar built by hand and integrated into the Forte IDE using tools that Forte provided.


    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: