tableSettingsDemo.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:3k
- /*$Id: tableSettingsDemo.src,v 1.3 2002/09/09 05:35:19 tonyjpaul Exp $*/
- /*
- * @(#)tableSettingsDemo.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the COPYRIGHTS file for more details.
- */
- /**
- * An example of using the SnmpTablePanel bean which is designed for large
- * table support.
- *
- **/
- import javax.swing.*;
- import javax.swing.table.*;
- import java.awt.*;
- import java.beans.*;
- import java.awt.event.*;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.applet.Applet;
- import com.adventnet.snmp.beans.*;
- import com.adventnet.snmp.ui.*;
- import javax.swing.event.*;
- import java.io.*;
- public class tableSettingsDemo extends JApplet implements ActionListener
- {
-
- JLabel l1;
- JLabel l2;
- JButton b1;
- JTextField t1;
- JTextField t2;
-
- PropertySettings pass;
-
- String oid;
- TableBean tablePanel;
-
- /** Supply command line arguments to this constructor **/
- public void init()
- {
-
- try {
- UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- System.err.println("Couldn't use the system look and feel: "+ e);
- }
- getContentPane().setLayout(null);
- setBackground(Color.lightGray);
- pass = new PropertySettings(this);
-
- l1 = new JLabel( "Table OID" );
- l2 = new JLabel("Result");
- b1 = new JButton();
- b1.setLabel("Get Agent Data");
- t1 = new JTextField("The Table OID is shown here");
- t2 = new JTextField("The data from the agent is shown here");
- b1.addActionListener(this);
- pass.setBounds(70,10,100,45);
- getContentPane().add(pass);
-
- l1.reshape(30,75,100,25);
- getContentPane().add(l1);
- t1.reshape(150,75,250,25);
- getContentPane().add(t1);
- l2.reshape(30,120,100,25);
- getContentPane().add(l2);
- tablePanel = new TableBean(this);
- tablePanel.setBackground(Color.white);
- tablePanel.setVisible(true);
- tablePanel.reshape(30,160,500,250);
- getContentPane().add(tablePanel);
-
- b1.setBounds(70, 430, 100, 25);
- getContentPane().add(b1);
- }
-
- public void start()
- {
- try {
- pass.addVetoableChangeListener(tablePanel.getSnmpTableModel());
-
- tablePanel.setMibModules( getParameter("MIBS") );
-
- tablePanel.setHost( getParameter("HOSTNAME") );
-
- tablePanel.setCommunity( getParameter("COMMUNITY") );
-
- oid = getParameter("OID");
- tablePanel.setTableOID( getParameter("OID"));
- t1.setText(tablePanel.getTableOID());
- } catch (Exception ex) {
- System.err.println("Error in starting applet: "+ex+":"+ex.getMessage());
- }
-
-
- }
-
- public void actionPerformed(ActionEvent e)
- {
-
-
- tablePanel.setTableOID( t1.getText());
-
- RequestEvent evt = new RequestEvent(b1,
- tablePanel.getTableOID(), RequestEvent.GET);
-
-
- }
- }