SnmpBarGraph.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: SnmpBarGraph.java,v 1.1 2002/06/15 14:40:08 ram Exp $ */
- /* SnmpBarGraph.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 SnmpBarGraph implements ResultListener {
-
- SnmpPoller poller = new SnmpPoller();
- PropertySettings pptysettings = new PropertySettings();
- BarGraphBean graph = new BarGraphBean();
- public static void main(String args[]) {
-
- SnmpBarGraph builder = new SnmpBarGraph();
- 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 BarGraphBean" );
- 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);
-
- }
- 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){
-
- }
- }
-