SASTestAppn.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
源码类别:

SNMP编程

开发平台:

C/C++

  1. /* $Id: SASTestAppn.java,v 1.2 2002/06/18 07:16:50 kousalya Exp $ */
  2. /* SASTestAppn.java
  3.  * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
  4.  * Please read the associated COPYRIGHTS file for more details.
  5.  */
  6. import javax.swing.*;
  7. import java.awt.*;
  8. import java.net.*; 
  9. import java.io.*; 
  10. import java.awt.event.*;
  11. import com.adventnet.snmp.sas.*;
  12. public class SASTestAppn implements ActionListener {
  13.   
  14.   
  15.     JTextArea textfield = new JTextArea();
  16.     JButton setbutton = new JButton();
  17.     SAServer sasserver;
  18. public static void main(String args[]) {
  19.     
  20.     SASTestAppn sasappn = new SASTestAppn();
  21.     JFrame frame = new JFrame();
  22.     frame.setVisible(true); 
  23.     frame.addWindowListener(new WindowAdapter() 
  24.           {
  25.               public void windowClosing(WindowEvent evt)
  26.               { 
  27.                   System.exit(0);
  28.               } 
  29.           });
  30.     frame.setSize(350,350); 
  31.     frame.setTitle( " Tutorial Example for starting SAS Server"  ); 
  32.     frame.getContentPane().setLayout(null);
  33.     frame.getContentPane().add(sasappn.setbutton);
  34.     sasappn.setbutton.setBounds(210,40,105,25);
  35.     sasappn.setbutton.setText("Start");
  36.     frame.getContentPane().add(sasappn.textfield);
  37.     sasappn.textfield.setBounds(30,80,490,120);
  38.     sasappn.textfield.setText("Press the start button to start SAS Server .......");
  39.     sasappn.setbutton.addActionListener(sasappn); 
  40.     frame.show();
  41.       
  42.  }
  43.     
  44.    public void actionPerformed(ActionEvent e) {
  45. if (e.getActionCommand().equals("Start")) {
  46.         sasserver = new SAServer();
  47.         sasserver.setFileOutput(true); 
  48. sasserver.start(); 
  49. textfield.setText("SAS Server is running now  .......");
  50. setbutton.setText("Stop");
  51. }
  52.    
  53. else if (e.getActionCommand().equals("Stop")) {
  54.      sasserver.close();
  55.      textfield.setText("Press the start button to start SAS Server .......");
  56.      setbutton.setText("Start");
  57. }
  58.    }
  59.     
  60.    
  61. }
  62.