Customization

 

The MibBrowser application that is bundled with AdventNet SNMP API is developed using the MibBrowser bean. Developers can customize the MibBrowser application to their own needs. This section explains the steps involved in customizing the MibBrowser application.

 

Customization of the MibBrowser application is explained in reference to the MibBrowserApplication file available in the <MibBrowser> directory.

  1. The title of the MibBrowser application can be customized. By default, the title is "AdventNet MibBrowser".

>public MibBrowserApplication()

{

super("AdventNet MibBrowser");

 

The title can be set to the window because the MibBrowser bean is a panel. The above title can be changed to the user's choice.

  1. You can set some of the values, such as remote host, MIB filename, etc. to be initialized when the application is started. The application can be customized to get the properties from the command line or from the application itself. The following are some of the properties that can be set.

Here, mibbrowser is the instance of the MibBrowser bean.

  1. You can customize the display of the MibBrowser menu bar. By default, it is set to false. You can display the menu bar by setting mbrowser.setMenuBarVisible() to true.

  2. You can customize the display of the MibBrowser display area. By default, the Result area and the MibDescription area are shown. You can set the MibBrowser display view to show the MibDescription panel, the ResultDisplay panel, or the MultiVarbind panel using the method setMibBrowserDisplayView(int view).

  3. You can add and remove toolbar buttons from the MibBrowser. The instance com.adventnet.snmp.ui.ToolBar can be obtained from the method getToolBar().

ToolBar toolbar = mbrowser.getToolBar();

//Exit button is added as below and ActionListener is implemented.

JButton button = toolbar.addButton("Exit",

new ImageIcon (getClass().getResource("exit.jpg")),"Exit MibBrowser");

button.addActionListener(this);

 

//Removing button from the Toolbar using index. Even the separator

//is a component and once the component is removed the index will

//be adjusted. Please be careful.

toolbar.removeComponentAt(int i);

  1. You can also add or remove menu item from the MibBrowser menu bar.

//Exit MenuItem is added as below and ActionListener is implemented.

JMenuBar bar = mbrowser.getMenuBar();

JMenu fileMenu = bar.getMenu(0);

fileMenu.addSeparator();

fileMenu.add(exitItem = new JMenuItem("Exit", 'x'));

exitItem.addActionListener(this);

  1. The Help and the About image can also be customized. The default help file has to be help/index.html file from the installed directory. The "about" dialog box image can be replaced by changing the about.jpg image file available in the <AdventNet/SNMPAPI/images> directory.

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.