home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JVISBRKR.Z / ApplicationDeniedPanel.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  6.0 KB  |  159 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 reason for credit denial 
  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. * ApplicationDeniedPanel displays a reason to the applicant for
  38. * not being approved.
  39. */
  40. public class ApplicationDeniedPanel extends BevelPanel {
  41.   Label label1 = new Label();
  42.   ImageControl imageControl1 = new ImageControl();
  43.   Label label2 = new Label();
  44.   Label label3 = new Label();
  45.   TextFieldControl textReason = new TextFieldControl();
  46.   ButtonControl buttonControl1 = new ButtonControl();
  47.   private CreditApprovalApplet theApplet = null;
  48.   BevelPanel bevelPanel1 = new BevelPanel();
  49.   BevelPanel bevelPanel2 = new BevelPanel();
  50.   FlowLayout flowLayout1 = new FlowLayout();
  51.   BevelPanel bevelPanel3 = new BevelPanel();
  52.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  53.   GridBagLayout gridBagLayout2 = new GridBagLayout();
  54.   BorderLayout borderLayout1 = new BorderLayout();
  55.   GridBagLayout gridBagLayout3 = new GridBagLayout();
  56.   GridBagLayout gridBagLayout4 = new GridBagLayout();
  57.   BevelPanel bevelPanel4 = new BevelPanel();
  58.   BorderLayout borderLayout2 = new BorderLayout();
  59.   GridBagLayout gridBagLayout5 = new GridBagLayout();
  60.   BorderLayout borderLayout3 = new BorderLayout();
  61.   ResourceBundle res = Res.getBundle("borland.reference.creditapproval.client.Res");
  62.  
  63.   /**
  64.   /* Default constructor - placed here for the sake of JavaBean compliance
  65.   */
  66.   public ApplicationDeniedPanel() {
  67.     try {
  68.       jbInit();
  69.     }
  70.     catch (Exception e) {
  71.       e.printStackTrace();
  72.     }
  73.   }
  74.  
  75.   /**
  76.   *  Construct the Panel by invoking jbInit
  77.   */
  78.   public ApplicationDeniedPanel(CreditApprovalApplet creditApp) {
  79.     theApplet = creditApp;
  80.     try {
  81.       jbInit();
  82.     }
  83.     catch (Exception e) {
  84.       e.printStackTrace();
  85.     }
  86.   }
  87.  
  88.   /**
  89.   *  Invoked by the Applet to set the Reason Text
  90.   */
  91.   public void setReason( String reason ) {
  92.     textReason.setText( reason );
  93.   }
  94.  
  95.   /**
  96.   *  Initialize the Panel
  97.   */
  98.   private void jbInit() throws Exception{
  99.     this.setSize(new Dimension(318, 342));
  100.     this.setLayout(borderLayout3);
  101.     label1.setForeground(Color.red);
  102.     label1.setFont(new Font("Dialog", 1, 18));
  103.     label1.setSize(new Dimension(607, 300));
  104.     label1.setAlignment(1);
  105.     label1.setText(res.getString("Sorry!"));
  106.     if (theApplet != null)
  107.       imageControl1.setImageURL( new java.net.URL(theApplet.getImageLocation() + "logo.gif"));
  108.     label2.setFont(new Font("Dialog", 1, 12));
  109.     label2.setBounds(new Rectangle(0, 0, 0, 0));
  110.     label2.setAlignment(1);
  111.     label2.setText(res.getString("Your_application_for"));
  112.     label3.setFont(new Font("Dialog", 1, 12));
  113.     label3.setAlignment(1);
  114.     label3.setText(res.getString("been_denied_for_the") + ":" );
  115.     textReason.setEditable(false);
  116.     buttonControl1.setLabel(res.getString("OK"));
  117.     buttonControl1.addActionListener(new ApplicationDeniedPanel_buttonControl1_actionAdapter(this));
  118.     bevelPanel4.setLayout(gridBagLayout5);
  119.     bevelPanel3.setLayout(gridBagLayout4);
  120.     bevelPanel1.setLayout(gridBagLayout3);
  121.     bevelPanel2.setLayout(flowLayout1);
  122.     this.add(bevelPanel1, BorderLayout.SOUTH);
  123.     bevelPanel1.add(buttonControl1, new GridBagConstraints2(0, 0, 2, 1, 0.0, 0.0
  124.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 0, 4, 0), 33, 0));
  125.     this.add(bevelPanel3, BorderLayout.CENTER);
  126.     bevelPanel3.add(label2, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  127.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(11, 0, 0, 0), 0, 0));
  128.     bevelPanel3.add(label3, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
  129.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  130.     bevelPanel3.add(textReason, new GridBagConstraints2(0, 2, 1, 1, 1.0, 1.0
  131.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 500155, 0));
  132.     this.add(bevelPanel2, BorderLayout.EAST);
  133.     bevelPanel2.add(imageControl1, null);
  134.     this.add(bevelPanel4, BorderLayout.NORTH);
  135.     bevelPanel4.add(label1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  136.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 250, 0));
  137.    }
  138.  
  139.   void buttonControl1_actionPerformed(ActionEvent e) {
  140.     if (theApplet != null)
  141.       theApplet.destroyApplet();
  142.   }
  143.  
  144. }
  145.  
  146. class ApplicationDeniedPanel_buttonControl1_actionAdapter implements java.awt.event.ActionListener{
  147.   ApplicationDeniedPanel adaptee;
  148.  
  149.   ApplicationDeniedPanel_buttonControl1_actionAdapter(ApplicationDeniedPanel adaptee) {
  150.     this.adaptee = adaptee;
  151.   }
  152.  
  153.   public void actionPerformed(ActionEvent e) {
  154.     adaptee.buttonControl1_actionPerformed(e);
  155.   }
  156. }
  157.  
  158.  
  159.