OpenJUMP
Adding A Toolbar Button

Here’s an example of adding a plugin to the toolbar as a button:

workbenchFrame.getToolBar().addPlugIn(outputWindowPlugIn.getIcon(), outputWindowPlugIn, new MultiEnableCheck(), workbenchContext)

Another way to do it is to use WorkbenchToolBar#add(AbstractButton button, String tooltip, Icon icon, ActionListener actionListener, EnableCheck enableCheck)

Still another way is to use WorkbenchToolBar#add(Component)



[31. Aug 2006]

Hei XXX,

to add a button you need:
  1. to specify an icon for you plugin => xxxPlugIn.getIcon();
  2. to add it to the toolbar. For Jump own plugins this is done in JumpConfiguration.configureToolBar(final WorkbenchContext workbenchContext, EnableCheckFactory checkFactory)
    e.g.
    
    WorkbenchFrame frame = workbenchContext.getWorkbench().getFrame();
        frame.getToolBar().addPlugIn(zoomToSelectedItemsPlugIn.getIcon(),
                   zoomToSelectedItemsPlugIn,
                   ZoomToSelectedItemsPlugIn.createEnableCheck(workbenchContext),
                   workbenchContext);
    

If you have access to the openjump c-v-s repository you can see an example in the NewTaskPlugIn.java in package com.vividsolutions.jump.workbench.ui.plugin; (which i added on the weekend to the toolbar of OpenJump)
another example .. if you use original JUMP .. may be look on ZoomToSelectedItemsPlugIn.java in package workbench.ui.zoom

stefan