sasapplication.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: sasapplication.java,v 1.4 2002/09/09 05:39:09 parasuraman Exp $ */
- /*
- * @(#)sasapplication.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- /**
- * This example shows how applications can use the sasappclient file by
- * plugging in their own Applet stub.
- *
- * It basically instantiates the sasappclient object, sets the user-defined
- * AppletStub stub into it.
- */
- import com.adventnet.management.transport.*;
- import com.adventnet.snmp.snmp2.*;
- import javax.swing.*;
- import java.awt.event.*;
- import java.net.*;
- public class sasapplication extends JFrame {
- sasapplication() {
- super("SAS Application");
- }
- public static void main (String[] args) {
- sasapplication testObj = new sasapplication();
- final sasappclient obj = new sasappclient();
- // Create the Applet stub & plug it into the Applet
- SASAppletStub sasStub = new SASAppletStub();
- sasStub.setParameter("TRANSPORT_PROVIDER","com.adventnet.management.transport.TcpClientTransportImpl");
- // localhost can be replaced by any host name
- sasStub.setParameter("HOST","localhost");
- // set the port parameter to the port in which SAServer is listening.
- sasStub.setParameter("PORT","8282");
- sasStub.setParameter("CODEBASE", "http://localhost:8282/");
- sasStub.setParameter("DOCUMENTBASE", "http://localhost:8282/");
- try {
- URL codebase = new URL("http://localhost:8282/");
- sasStub.setCodeBase(codebase);
- sasStub.setDocumentBase(codebase);
- } catch (Exception e) {};
- obj.setStub(sasStub);
- // Start the Applet
- obj.init();
- obj.start();
- // Set UI properties of the frame
- testObj.getContentPane().add (obj);
- testObj.pack();
- testObj.setVisible(true);
- // Set the window listener behaviour
- WindowAdapter win = new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- obj.stop();
- System.exit(0);
- }
- };
- testObj.addWindowListener(win);
- }
- }