home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JVISBRKR.Z / SystemErrorPanel.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  6.1 KB  |  162 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20. //--------------------------------------------------------------------------------------------------
  21. // CORBA Reference Application
  22. // Copyright (c) 1997 by Borland International, All Rights Reserved
  23. //
  24. // Panel used to display System Error Information
  25. //--------------------------------------------------------------------------------------------------
  26.  
  27. package borland.reference.creditapproval.client;
  28.  
  29. import java.awt.*;
  30. import java.awt.event.*;
  31. import borland.jbcl.layout.*;
  32. import borland.jbcl.control.*;
  33. import java.util.*;
  34. import java.applet.*;
  35.  
  36. /**
  37. * SystemErrorPanel displays system errors to the applicant
  38. */
  39. public class SystemErrorPanel extends Panel {
  40.   Label label1 = new Label();
  41.   ImageControl imageControl1 = new ImageControl();
  42.   Label label2 = new Label();
  43.   Label label3 = new Label();
  44.   TextFieldControl textError = new TextFieldControl();
  45.   ButtonControl buttonControl1 = new ButtonControl();
  46.   private CreditApprovalApplet theApplet = null;
  47.   BevelPanel bevelPanel1 = new BevelPanel();
  48.   BevelPanel bevelPanel2 = new BevelPanel();
  49.   FlowLayout flowLayout1 = new FlowLayout();
  50.   BevelPanel bevelPanel3 = new BevelPanel();
  51.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  52.   GridBagLayout gridBagLayout2 = new GridBagLayout();
  53.   BorderLayout borderLayout1 = new BorderLayout();
  54.   GridBagLayout gridBagLayout3 = new GridBagLayout();
  55.   GridBagLayout gridBagLayout4 = new GridBagLayout();
  56.   BevelPanel bevelPanel4 = new BevelPanel();
  57.   GridBagLayout gridBagLayout5 = new GridBagLayout();
  58.   BorderLayout borderLayout2 = new BorderLayout();
  59.   BorderLayout borderLayout3 = new BorderLayout();
  60.   ResourceBundle res = Res.getBundle("borland.reference.creditapproval.client.Res");
  61.  
  62.   /**
  63.   /* Default constructor - placed here for the sake of JavaBean compliance
  64.   */
  65.   public SystemErrorPanel() {
  66.     try {
  67.       jbInit();
  68.     }
  69.     catch (Exception e) {
  70.       e.printStackTrace();
  71.     }
  72.   }
  73.  
  74.   /**
  75.   *  Construct the Panel by invoking jbInit
  76.   */
  77.   public SystemErrorPanel(CreditApprovalApplet creditApp) {
  78.     theApplet = creditApp;
  79.     try {
  80.       jbInit();
  81.     }
  82.     catch (Exception e) {
  83.       e.printStackTrace();
  84.     }
  85.   }
  86.  
  87.   /**
  88.   * Invoked by the applet to set the displayed error text
  89.   */
  90.   public void setError( String error ) {
  91.     textError.setText( error );
  92.   }
  93.  
  94.   /**
  95.   *  Initialize the Panel
  96.   */
  97.   private void jbInit() throws Exception{
  98.     this.setSize(new Dimension(534, 280));
  99.     this.setLayout(borderLayout3);
  100.     label1.setForeground(Color.red);
  101.     label1.setFont(new Font("Dialog", 1, 18));
  102.     label1.setSize(new Dimension(607, 300));
  103.     label1.setAlignment(1);
  104.     label1.setText(res.getString("System_Error"));
  105.     if (theApplet != null)
  106.       imageControl1.setImageURL( new java.net.URL(theApplet.getImageLocation() + "logo.gif"));
  107.     label2.setFont(new Font("Dialog", 1, 12));
  108.     label2.setBounds(new Rectangle(0, 0, 0, 0));
  109.     label2.setAlignment(1);
  110.     label2.setText(res.getString("The_following_System"));
  111.     label3.setFont(new Font("Dialog", 1, 12));
  112.     label3.setAlignment(1);
  113.     label3.setText(res.getString("the_processing_of"));
  114.     textError.setEditable(false);
  115.     buttonControl1.setLabel(res.getString("OK"));
  116.     bevelPanel4.setLayout(gridBagLayout5);
  117.     bevelPanel3.setLayout(gridBagLayout4);
  118.     bevelPanel1.setLayout(gridBagLayout3);
  119.     bevelPanel2.setLayout(flowLayout1);
  120.     buttonControl1.addActionListener(new SystemErrorPanel_buttonControl1_actionAdapter(this));
  121.     this.add(bevelPanel1, BorderLayout.SOUTH);
  122.     bevelPanel1.add(buttonControl1, new GridBagConstraints2(0, 0, 2, 1, 0.0, 0.0
  123.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 0, 4, 0), 33, 0));
  124.     this.add(bevelPanel3, BorderLayout.CENTER);
  125.     bevelPanel3.add(label2, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  126.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(11, 0, 0, 0), 0, 0));
  127.     bevelPanel3.add(label3, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
  128.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  129.     bevelPanel3.add(textError, new GridBagConstraints2(0, 2, 1, 1, 1.0, 1.0
  130.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 500155, 0));
  131.     this.add(bevelPanel2, BorderLayout.EAST);
  132.     bevelPanel2.add(imageControl1, null);
  133.     this.add(bevelPanel4, BorderLayout.NORTH);
  134.     bevelPanel4.add(label1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  135.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  136.   }
  137.  
  138.   /**
  139.   * Re-display the application panel so that the user may submit
  140.   * their application again.
  141.   */
  142.   void buttonControl1_actionPerformed(ActionEvent e) {
  143.     if (theApplet != null)
  144.       theApplet.displayApplication();
  145.   }
  146. }
  147.  
  148. /**
  149. * ActionListner Class used for the OK button
  150. */
  151. class SystemErrorPanel_buttonControl1_actionAdapter implements java.awt.event.ActionListener{
  152.   SystemErrorPanel adaptee;
  153.  
  154.   SystemErrorPanel_buttonControl1_actionAdapter(SystemErrorPanel adaptee) {
  155.     this.adaptee = adaptee;
  156.   }
  157.  
  158.   public void actionPerformed(ActionEvent e) {
  159.     adaptee.buttonControl1_actionPerformed(e);
  160.   }
  161. }
  162.