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 * XMLSpy manager control - always needed
03 */
04 public static XMLSpyControl xmlSpyControl = null;
05
06 /**
07 * XMLSpy document editing control
08 */
09 public static XMLSpyControlDocument xmlSpyDocument = null;
10
11 /**
12 * Tool windows - XMLSpy place-holder controls
13 */
14 private static XMLSpyControlPlaceHolder xmlSpyProjectToolWindow = null;
15 private static XMLSpyControlPlaceHolder xmlSpyXpathToolWindow = null;
16 private static XMLSpyControlPlaceHolder xmlSpyEHAttributeToolWindow = null;
17
18 // Create the XMLSpy ActiveX control; the parameter determines that we want
19 // to place document controls and place-holder controls individually.
20 // It gives us full control over the menu, as well.
21 xmlSpyControl = new XMLSpyControl(
ICActiveXIntegrationLevel.ICActiveXIntegrationOnDocumentLevel.getValue() );
22 xmlSpyDocument = new XMLSpyControlDocument();
23 xmlSpyDocument.setPreferredSize( new Dimension ( 640, 480 ) );
24
25 // Create a project window and open the sample project in it
26 xmlSpyProjectToolWindow = new XMLSpyControlPlaceHolder(
27 XMLSpyControlPlaceholderWindow.XMLSpyControlProjectWindowToolWnd.getValue() );
28 xmlSpyProjectToolWindow.setPreferredSize( new Dimension( 200, 200 ) );
29 xmlSpyXpathToolWindow = new XMLSpyControlPlaceHolder(
XMLSpyControlPlaceholderWindow.XMLSpyControlXPathDialogToolWnd.getValue() );
30 xmlSpyEHAttributeToolWindow = new XMLSpyControlPlaceHolder(
XMLSpyControlPlaceholderWindow.XMLSpyControlEntryHelperTopToolWnd.getValue() );
31
32 frame.add( xmlSpyControl, BorderLayout.NORTH );
33 frame.add( xmlSpyDocument, BorderLayout.CENTER );
34 southPanel.add( xmlSpyProjectToolWindow );
35 southPanel.add( xmlSpyXpathToolWindow );
36 southPanel.add( xmlSpyEHAttributeToolWindow );