SnmpGraph.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: SnmpGraph.java,v 1.2 2002/06/18 07:18:39 kousalya Exp $ */
- /* SnmpGraph.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.event.*;
- import com.adventnet.snmp.beans.*;
- import com.adventnet.snmp.ui.*;
- public class SnmpGraph implements ResultListener {
-
- SnmpPoller poller = new SnmpPoller();
- PropertySettings pptysettings = new PropertySettings();
- LineGraphBean graph = new LineGraphBean();
- public static void main(String args[]) {
-
- SnmpGraph builder = new SnmpGraph();
- JFrame frame = new JFrame();
- frame.setVisible(true);
- frame.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent evt)
- {
- System.exit(0);
- }
- });
- frame.setSize(615,400);
- frame.setTitle( " Tutorial Example for SNMP Poller and LineGraphBean" );
- frame.getContentPane().setLayout(null);
- frame.getContentPane().add(builder.graph);
- builder.graph.setBounds(160,5,270,225);
- builder.poller.setTargetHost("localhost");
- builder.poller.setObjectID(".1.3.6.1.2.1.4.3.0");
- frame.getContentPane().add(builder.pptysettings);
- builder.pptysettings.setBounds(305,245,85,55);
- builder.pptysettings.addVetoableChangeListener(builder.poller);
- builder.poller.addResultListener(builder.graph);
- frame.show();
- }
- public void setNumericResult(long l){
- }
- public void setResult(ResultEvent result){
- try {
- graph.setResult(result.getNumericValue());
- } catch (DataException de) {
- System.out.println("Error in getting agent data: "+de +
- result.getErrorString());
- }
- }
-
-
- public void setStringResult(String s){
-
- }
- }
-