Oracle8i CORBA Developer's Guide and Reference
Release 3 (8.1.7)

Part Number A83722-01

Library

Solution Area

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

Visigenic Applet

README

To run VisiClient applet, you need to do the following.

Start osagent and gatekeeper (with port 16000)
(for gate keeper, create a file called gatekeeper.properties and just
put this entry in there : exterior_port=16000)

Then start the Bank server (vbj Server &).

Your browser should have Jinitiator installed (use ojdk-pc.us.oracle.com
for getting JInitiator, jdk 1.1.7.18)
(Browser security doesn't have to be off, i.e, you may set it to
AppletHost in Jinitiator)

Then simply connect to  mysun:8080/applets/bank/VisiClient.html

HTML for Visigenic Client Applet

<h1>Visigenic Client applet</h1>
   <COMMENT>
   <EMBED   type="application/x-jinit-applet;version=1.1.7.18"
      java_CODE="VisiClientApplet"
      java_CODEBASE="http://mysun:8080/applets/bank"
      java_ARCHIVE="visiClient.jar,vbjorb.jar,vbjapp.jar"
      WIDTH=400
      HEIGHT=100
      ORBgatekeeperIOR="http://mysun:16000/gatekeeper.ior"
      USE_ORB_LOCATOR="true"
      ORBbackCompat="true"
      serverHost="mysun"
      serverPort=8080
      <NOEMBED>
      </COMMENT>
      </NOEMBED>
    </EMBED>

Visigenic Client Applet

// ClientApplet.java

import java.awt.*;

public class VisiClientApplet extends java.applet.Applet {

  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);
    // 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 boolean action(Event ev, Object arg) {
    if(ev.target == _checkBalance) {
      // 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()));
      return true;
    }
    return false;
  }

}



Go to previous page
Go to beginning of chapter
Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Solution Area

Contents

Index