SnmpGetApplet.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: SnmpGetApplet.java,v 1.1 2002/06/15 14:43:56 ram Exp $ */
- /* SnmpGetApplet.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- import java.applet.*;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- import com.adventnet.snmp.beans.*;
- import com.adventnet.snmp.ui.*;
- public class SnmpGetApplet extends JApplet implements ActionListener {
- SnmpTarget target;
- PropertySettings pptysettings = new PropertySettings(this);
- JButton button = new JButton();
- JButton button1 = new JButton();
- JButton button2 = new JButton();
- JTextField textfield = new JTextField();
- JTextField textfield1 = new JTextField();
- JLabel label = new JLabel();
-
- public SnmpGetApplet()
- {
- super();
- }
- public void init() {
- getContentPane().setLayout(null);
- getContentPane().add(label);
- label.setBounds(105,40,105,25);
- label.setText("Enter the OID");
- getContentPane().add(textfield1);
- textfield1.setBounds(210,40,140,25);
- getContentPane().add(textfield);
- textfield.setBounds(30,80,490,85);
- getContentPane().add(button);
- button.setBounds(80,195,105,35);
- button.setText("GET");
-
- getContentPane().add(button1);
- button1.setBounds(185,195,105,35);
- button1.setText("GET NEXT");
- getContentPane().add(button2);
- button2.setBounds(290,195,105,35);
- button2.setText("Clear");
-
- getContentPane().add(pptysettings);
- pptysettings.setBounds(395,190,85,55);
- }
- public void start() {
- target = new SnmpTarget(this);
- target.setTargetHost("localhost");
- pptysettings.addVetoableChangeListener(target);
- button.addActionListener(this);
- button1.addActionListener(this);
- button2.addActionListener(this);
- }
-
- public void actionPerformed(ActionEvent e) {
-
- if (e.getActionCommand().equals("GET")) {
-
- target.setObjectID(textfield1.getText());
- textfield.setText(target.snmpGet());
- }
-
- else if (e.getActionCommand().equals("GET NEXT")) {
- textfield.setText(target.snmpGetNext());
- }
-
- else if (e.getActionCommand().equals("Clear")) {
- textfield.setText("");
- }
- }
-
-
- }
-