Visual Java Beans


In this topic


About Visual Java Beans

The ArcGIS Visual Java Beans are components provided by ESRI to enhance the development experience of ArcObjects Java developers. The ArcGIS Engine controls, such as the MapControl, PageLayoutControl, GlobeControl, SceneControl, ToolbarControl, TOCControl, and SymbologyControl are ActiveX components. They are presented as Abstract Window Toolkit (AWT) controls by the Java-COM Interop to Java developers.
AWT Engine controls can be embedded in any graphical user interface (GUI) application. However, they do not offer the drag-and-drop functionality, which is most often required for visual presentation during design time. Hence, AWT Engine controls are wrapped as Visual Java Beans to enable drag-and-drop capability during design time. 
The Visual Java Beans conform to the Java Beans component architecture and can be used as drag-and-drop components in Java Bean compatible integrated development environments (IDE). The following illustration shows the underlying concept of Visual Java Beans:
  
Visual Java Beans and ArcGIS Engine controls can be used interchangeably to build ArcGIS Engine applications. The properties and methods offered by Visual Java Beans and ArcGIS Engine controls are one and the same, and have the same effect on the application. The following table shows Visual Java Beans and their corresponding ArcGIS Engine controls:
Visual Java Beans
ArcGIS Engine controls
MapBean
MapControl
PageLayoutBean
PageLayoutControl
TOCBean
TOCControl
ToolbarBean
ToolbarControl
SymbologyBean
SymbologyControl
GlobeBean
GlobeControl
SceneBean
SceneControl
The following screen shot shows the ArcGIS Components palette, which contains Visual Java Beans as shown in the Eclipse IDE:
 
For more information about building applications using Visual Java Beans and its drag-and-drop capability, see the following topics:
ArcGIS Engine controls and Visual Java Beans have been used interchangeably in all topics.

Advantages of Visual Java Beans

The following are the advantages of using Visual Java Beans over Engine controls: 
  1. Visual Java Beans can be visually manipulated to build GUI applications during design time. The following screen shot shows a visual representation of a simple application created using JFrame and Visual Java Beans in the Eclipse IDE. The position and size of the Visual Java Beans can be altered in an application at design time. 
  1. Visual Java Beans also facilitate configuring the Engine control's properties, such as its Appearance, Border Style, setDocumentName, ShowToolTips, and so on, using the Java Property Editor dialog box during design time. The following screen shot shows a typical Java Property Editor for a ToolbarBean:

Using Visual Java Beans

  • Initializing Visual Java Beans—Similar to ArcGIS Engine controls, it is necessary to initialize the Java Interop using the EngineInitializer.initializeVisualBeans() method to use Visual Java Beans in your applications. 
  • Mixing Visual Java Beans and other Swing components—Visual Java Beans are Swing components, which in turn, contain heavyweight AWT Engine controls. Therefore, when mixing with other lightweight Swing components, Visual Java Beans behave as AWT heavyweight components. Therefore, when using other Swing components in your application, disable lightweight pop-up components where the option is available. See the following code example:
[Java]
jComboBox.setLightWeightPopupEnabled(false);
jPopupMenu.setLightWeightPopupEnabled(false);
  • Threading—The events fired by Visual Java Beans are similar to ArcGIS Engine controls. They are not called on the AWT event dispatching thread, but in a separate worker thread created by the Java-COM Interop. In these situations, Sun recommends the SwingUtilities.invokeLater() method be used to change the state of other Swing components. See the following code example:
[Java]
mapBean.addIMapControlEvents2Listener(new IMapControlEvents2Adapter(){
    private void mapControlOnMouseDown(IMapControlEvents2OnMouseDownEvent evt)throws
        java.io.IOException{
        Runnable r = new Runnable(){
            public void run(){
                System.out.println("Mouse clicked"); 
                // Show a Swing JPopupMenu.
                jPopupMenu1.show(mapBean, evt.getX(), evt.getY()); 
            }
        }; SwingUtilities.invokeLater(r); 
    }
}

);
In summary, Visual Java Beans behave similar to ArcGIS Engine controls in the areas of threading, mixing heavyweight and lightweight components, and listening to events and drawing. For more information, see Building applications with ArcGIS Engine controls.






Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo