home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 8.3 KB | 200 lines |
- /*
- * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
- *
- * This SOURCE CODE FILE, which has been provided by Borland as part
- * of a Borland product for use ONLY by licensed users of the product,
- * includes CONFIDENTIAL and PROPRIETARY information of Borland.
- *
- * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
- * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
- * THE PRODUCT.
- *
- * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
- * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
- * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
- * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
- * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
- * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
- * CODE FILE.
- */
- //--------------------------------------------------------------------------------------------------
- // CORBA Reference Application
- // Copyright (c) 1997 by Borland International, All Rights Reserved
- //
- // Panel used to display Credit Card Iformation for approved Applicants
- //--------------------------------------------------------------------------------------------------
-
- package borland.reference.creditapproval.client;
-
- import java.awt.*;
- import java.text.*;
- import java.awt.event.*;
- import borland.jbcl.layout.*;
- import borland.jbcl.control.*;
- import java.util.*;
- import java.applet.*;
- import borland.reference.creditapproval.CORBAInterface.*;
-
- /**
- * ApplicationApprovedPanel displays the credit card information for
- * approved applicants.
- */
- public class ApplicationApprovedPanel extends BevelPanel {
- Label label1 = new Label();
- Label label3 = new Label();
- Label label4 = new Label();
- Label label5 = new Label();
- ImageControl imageControl1 = new ImageControl();
- Label label2 = new Label();
- Label label6 = new Label();
- Label label7 = new Label();
- ButtonControl buttonControl1 = new ButtonControl();
- BevelPanel bevelPanel1 = new BevelPanel();
- BevelPanel bevelPanel2 = new BevelPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
- FlowLayout flowLayout1 = new FlowLayout();
- BevelPanel bevelPanel3 = new BevelPanel();
- GridBagLayout gridBagLayout2 = new GridBagLayout();
- BevelPanel bevelPanel4 = new BevelPanel();
- GridBagLayout gridBagLayout3 = new GridBagLayout();
- ResourceBundle res = Res.getBundle("borland.reference.creditapproval.client.Res");
- CreditApprovalApplet theApplet = null;
- TextField textExpirationDate = new TextField();
- TextField textCreditLimit = new TextField();
- TextField textCreditCardNumber = new TextField();
- BorderLayout borderLayout1 = new BorderLayout();
-
- /**
- /* Default constructor - placed here for the sake of JavaBean compliance
- */
- public ApplicationApprovedPanel() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Construct the Panel by invoking jbInit
- */
- public ApplicationApprovedPanel(CreditApprovalApplet creditApp) {
- theApplet = creditApp;
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- resetEdges();
- }
-
- /**
- * Initialize the Panel
- */
- private void jbInit() throws Exception{
- this.setLayout(borderLayout1);
- this.setBevelInner(BevelPanel.FLAT);
- textCreditCardNumber.setEditable(false);
- textExpirationDate.setEditable(false);
- label1.setForeground(Color.red);
- label1.setFont(new Font("Dialog", 1, 18));
- label1.setAlignment(1);
- label1.setText(res.getString("Congratulations"));
- label3.setFont(new Font("Dialog", 1, 12));
- label3.setBounds(new Rectangle(10, 17, 368, 23));
- label3.setAlignment(1);
- label3.setText(res.getString("You_have_been"));
- label4.setFont(new Font("Dialog", 1, 12));
- label4.setAlignment(1);
- label4.setText(res.getString("Please_make_a_note_of"));
- label5.setFont(new Font("Dialog", 1, 12));
- label5.setBounds(new Rectangle(0, 63, 368, 23));
- label5.setAlignment(1);
- label5.setText(res.getString("Apermanent_card_will"));
- if (theApplet != null)
- imageControl1.setImageURL( new java.net.URL(theApplet.getImageLocation() + "logo.gif"));
- label2.setFont(new Font("Dialog", 1, 12));
- label2.setText(res.getString("Credit_Card_Number") + ":");
- label6.setFont(new Font("Dialog", 1, 12));
- label6.setText(res.getString("Expiration_Date") + ":");
- label7.setFont(new Font("Dialog", 1, 12));
- label7.setText(res.getString("Credit_Limit") + ":");
- textCreditLimit.setEditable(false);
- buttonControl1.setLabel(res.getString("OK"));
- bevelPanel4.setLayout(gridBagLayout3);
- bevelPanel3.setLayout(gridBagLayout2);
- bevelPanel1.setLayout(flowLayout1);
- bevelPanel2.setLayout(gridBagLayout1);
- buttonControl1.addActionListener(new ApplicationApprovedPanel_buttonControl1_actionAdapter(this));
- bevelPanel1.add(imageControl1, null);
- this.add(bevelPanel1, BorderLayout.EAST);
- bevelPanel2.add(buttonControl1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 0, 4, 0), 33, 0));
- this.add(bevelPanel2, BorderLayout.SOUTH);
- this.add(bevelPanel3, BorderLayout.NORTH);
- bevelPanel3.add(label1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- this.add(bevelPanel4, BorderLayout.CENTER);
- bevelPanel4.add(label7, new GridBagConstraints2(0, 5, 1, 1, 0.0, 1.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, 24, 0, 0), 45, 0));
- bevelPanel4.add(textCreditLimit, new GridBagConstraints2(1, 5, 1, 1, 0.0, 1.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 54, 0));
- bevelPanel4.add(textExpirationDate, new GridBagConstraints2(1, 4, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 54, 0));
- bevelPanel4.add(label6, new GridBagConstraints2(0, 4, 1, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 24, 0, 0), 24, 0));
- bevelPanel4.add(textCreditCardNumber, new GridBagConstraints2(1, 3, 2, 1, 1.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 161, 0));
- bevelPanel4.add(label2, new GridBagConstraints2(0, 3, 1, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 24, 0, 0), -2, 0));
- bevelPanel4.add(label5, new GridBagConstraints2(0, 2, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 8, 0), 48, 0));
- bevelPanel4.add(label4, new GridBagConstraints2(0, 1, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 46, 0));
- bevelPanel4.add(label3, new GridBagConstraints2(0, 0, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(8, 0, 0, 0), 52, 0));
- }
-
- /**
- * Sets the text of the visual controls to reflect the credit card information
- * Invoked by the Applet after an applicant has been approved.
- *
- * Format the output using the current Locale
- */
- public void setCreditCardInformation(creditApprovalStruct creditCardInfo) {
-
- textCreditCardNumber.setText(creditCardInfo.creditCardNumber);
- textCreditLimit.setText(NumberFormat.getCurrencyInstance().format(creditCardInfo.limit));
- textExpirationDate.setText(DateFormat.getDateInstance( DateFormat.SHORT ).format(
- java.sql.Date.valueOf( creditCardInfo.expirationDate)));
- }
-
- /**
- * Destroy the applet when the user presses the OK button
- */
- void buttonControl1_actionPerformed(ActionEvent e) {
- if (theApplet != null)
- theApplet.destroyApplet();
- }
-
- }
-
- /**
- * ActionListner Class used for the OK button
- */
- class ApplicationApprovedPanel_buttonControl1_actionAdapter implements java.awt.event.ActionListener{
- ApplicationApprovedPanel adaptee;
-
- ApplicationApprovedPanel_buttonControl1_actionAdapter(ApplicationApprovedPanel adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.buttonControl1_actionPerformed(e);
- }
- }
-
-
-