Creating the ActiveX Controls
The code listing below show how ActiveX controls can be created. The constructors will create the Java wrapper objects. Adding these Canvas-derived objects to a panel or to a frame will trigger the creation of the wrapped ActiveX object.
01 /**
02 * MapForce manager control - always needed
03 */
04 public static MapForceControl mapForceControl = null;
05
06 /**
07 * MapForceDocument editing control
08 */
09 public static MapForceControlDocument mapForceDocument = null;
10
11 /**
12 * Tool windows - MapForce place-holder controls
13 */
14 private static MapForceControlPlaceHolder mapForceProjectToolWindow = null;
15 private static MapForceControlPlaceHolder mapForceValidationToolWindow = null;
16 private static MapForceControlPlaceHolder mapForceLibraryToolWindow = null;
17
18 // Create the MapForce ActiveX control; the parameter determines that we want
// to place document controls and place-holder controls individually.
19 // It gives us full control over the menu, as well.
20 mapForceControl = new MapForceControl(
ICActiveXIntegrationLevel.ICActiveXIntegrationOnDocumentLevel.getValue(), false );
21
22 mapForceDocument = new MapForceControlDocument();
23 frame.add( mapForceDocument, BorderLayout.CENTER );
24
25
26 // Create a project window and open the sample project in it
27 mapForceProjectToolWindow = new MapForceControlPlaceHolder(
MapForceControlPlaceholderWindow.MapForceXProjectWindow.getValue(),
strExamplesFolder + "MapForceExamples.mfp" ) ;
28 mapForceProjectToolWindow.setPreferredSize( new Dimension( 200, 200 ) );