home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 2.3 KB | 59 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.
- */
- package visibroker.samples.bank;
-
- import java.awt.*;
- import java.awt.event.*;
- import org.omg.CORBA.*;
-
- public class ClientApplet extends java.applet.Applet implements ActionListener {
-
- private TextField _nameField, _balanceField;
- private Button _checkBalance;
- private Bank.AccountManager _manager;
-
- public void init() {
- // This GUI uses a 2 by 2 grid of widgets.
- setLayout(new GridLayout(2, 2, 5, 5));
- // Add the four widgets.
- add(new Label("Account Name"));
- add(_nameField = new TextField());
- add(_checkBalance = new Button("Check Balance"));
- add(_balanceField = new TextField());
- // make the balance text field non-editable.
- _balanceField.setEditable(false);
- // Enable action events for the _checkBalance button.
- _checkBalance.addActionListener(this);
- // Initialize the ORB (using the Applet).
- org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(this, null);
- // Locate an account manager.
- _manager = Bank.AccountManagerHelper.bind(orb, "BankManager");
- }
-
- public void actionPerformed(ActionEvent ev) {
- // Request the account manager to open a named account.
- // Get the account name from the name text widget.
- Bank.Account account = _manager.open(_nameField.getText());
- // Set the balance text widget to the account's balance.
- _balanceField.setText(Float.toString(account.balance()));
- }
-
- }
-