SASTestAppn.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: SASTestAppn.java,v 1.2 2002/06/18 07:16:50 kousalya Exp $ */
- /* SASTestAppn.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- import javax.swing.*;
- import java.awt.*;
- import java.net.*;
- import java.io.*;
- import java.awt.event.*;
- import com.adventnet.snmp.sas.*;
- public class SASTestAppn implements ActionListener {
-
-
- JTextArea textfield = new JTextArea();
- JButton setbutton = new JButton();
- SAServer sasserver;
- public static void main(String args[]) {
-
- SASTestAppn sasappn = new SASTestAppn();
- JFrame frame = new JFrame();
- frame.setVisible(true);
- frame.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent evt)
- {
- System.exit(0);
- }
- });
- frame.setSize(350,350);
- frame.setTitle( " Tutorial Example for starting SAS Server" );
- frame.getContentPane().setLayout(null);
- frame.getContentPane().add(sasappn.setbutton);
- sasappn.setbutton.setBounds(210,40,105,25);
- sasappn.setbutton.setText("Start");
- frame.getContentPane().add(sasappn.textfield);
- sasappn.textfield.setBounds(30,80,490,120);
- sasappn.textfield.setText("Press the start button to start SAS Server .......");
- sasappn.setbutton.addActionListener(sasappn);
- frame.show();
-
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals("Start")) {
- sasserver = new SAServer();
- sasserver.setFileOutput(true);
- sasserver.start();
- textfield.setText("SAS Server is running now .......");
- setbutton.setText("Stop");
- }
-
- else if (e.getActionCommand().equals("Stop")) {
- sasserver.close();
- textfield.setText("Press the start button to start SAS Server .......");
- setbutton.setText("Start");
- }
-
-
- }
-
-
- }
-