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. For more information, see Understanding Java Interop.
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
From within Eclipse, you can configure a custom Palette category and import ready-to-use Java Beans from the arcobjects.jar into it. Below is an example of a custom category which contains the ArcObjects 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 How to build an application in Eclipse using visual beans.
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

See the following items regarding using Visual Java Beans:
[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 ArcGIS Engine controls






Development licensingDeployment licensing
Engine Developer KitEngine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced