Customizing CLI Browser

 

The CLI Browser application bundled with WebNMS CLI API is developed using the CLIBrowser Bean. You can customize the CLI Browser application according to your requirements. It drastically reduces the work-in-process. The following will give details regarding the customization of the CLIBrowser Application.

  1. The title of the CLI Browser application can be customized, i.e. there is a provision that allows the developers to change the title "WebNMS CLIBrowser" according to the their choice. As the CLIBrowser Bean is a panel, the title can be set to the Window.

public CLIBrowserApplication() { super("AdventNet CLIBrowser");

  1. The toolbar buttons can be added and removed. The following methods makes the job easy to add new buttons and remove the default buttons so that customization becomes an easy task for the developers.

ToolBar instance can be obtained using the method getToolBar()

 

CLIBrowser browser = new CLIBrowser();

JToolBar toolBar = browser.getToolBar();

//Exit button is added as below and action listener is implemented. Button button = toolBar.add( new ImageIcon (getClass().getResource("exit.png")));

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.remove(int i)

  1. you can customize the display of the CLI Browser menu bar. The menu bar can be modified according to your requirement, which allows you to create new menus in CLI browser.

MenuBar menuBar = browser.getMenuBar();

JMenu fileMenu = menuBar.getMenu(0);

fileMenu.addSeparator();

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

  1. The help index can also be customized. The default help file has to be help/index.html file from the installed CLI Home directory. The help location can be changed by using the method setHelpLocation(..) available in the CLI Browser Bean.

Related Topics

 



Copyright © 2009 ZOHO Corp. All Rights Reserved.