Class ActiveXControl
public class ActiveXControl extends ActiveXComponent
implements Serializable, HeavyComponent
{
// Fields
public static final int CURRENCY;
public static final int DATE;
public static final int DOUBLE;
// Constructors
public ActiveXControl();
public ActiveXControl(String clsid);
public ActiveXControl(IUnknown punk);
// Methods
public void activate();
public void activateNoGUI();
public void addActiveXControlListener(
ActiveXControlListener listener);
protected void createControl(String clsid) throws Exception;
protected void createControl(IUnknown punk) throws Exception;
protected void finalize() throws Throwable;
public Dimension getMinimumSize();
public Dimension getPreferredSize();
public boolean isFocusTraversable();
public synchronized void processComponentEvent(
ComponentEvent event);
public void processFocusEvent(FocusEvent event);
public void removeActiveXControlListener(
ActiveXControlListener listener);
public void removeNotify();
public void setBackground(Color c);
public void setDesignMode(boolean b);
public void setFont(Font f);
public void setForeground(Color c);
public void setProperty(String name, String value);
public void setProperty(String name, int value);
public void setProperty(String name, short value);
public void setProperty(String name, boolean value);
public void setProperty(String name, long value, int flag);
public void setProperty(String name, double value);
public void setProperty(String name, double value, int flag);
public void setProperty(String name, float value);
public void setProperty(String name, Variant value);
public void showPropertyDialog();
}
This class exposes methods, properties, and events used to host Microsoft® ActiveX® controls. Instances of the ActiveXControl class are objects that enable Java components to host ActiveX controls.
Canvas
|
+--ActiveXComponent
|
+--ActiveXControl
public ActiveXControl();
Creates an ActiveXControl object that is a container for an ActiveX control. To add a control to the container, you can call the createControl method.
public ActiveXControl(String clsid);
Creates an ActiveXControl object that is a container for an ActiveX control. This method hosts the control specified by the CLSID (class identifier) or ProgID (programatic identifier).
Parameter | Description |
clsid
| Identifies the CLSID (or ProgID) for the ActiveX control. The CLSID is in the form "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", where x is a valid hexadecimal number.
|
public ActiveXControl(IUnknown punk);
Creates an ActiveXControl object that is a container for an ActiveX control. This method hosts a control that has already been created.
Parameter | Description |
punk
| The identity of the ActiveX control.
|
public void activate();
Tells the control to become in-place active.
Note By default, a control is activated at addNotify time. Therefore, if an ActiveXControl object needs properties for initialization, calls to the setProperty method should be made before addNotify time.
Return Value:
No return value.
public void activateNoGUI();
Activates a non-GUI control. By default, all ActiveX controls are assumed to have UI. However, the negotiation for such a control happens at addNotify time when an object is added to a layout. You should call this method to activate a control that does not have GUI representation.
Return Value:
No return value.
public void addActiveXControlListener(ActiveXControlListener listener);
Adds an ActiveXControlListener object that listens to events sourced by the ActiveXControl class.
Return Value:
No return value.
protected void createControl(String clsid) throws Exception;
Creates an ActiveXControl object that is a container for an ActiveX control. This method hosts the control specified by the CLSID (or ProgID).
Return Value:
No return value.
Parameter | Description |
clsid
| Identifies the CLSID (or ProgID) for the ActiveX control. The CLSID is in the form "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", where "x" is a valid hexadecimal number.
|
Remarks:
This method is used to defer the hosting of an ActiveX control, and is typically used when a control host was created using the ActiveXControl() constructor or when extending the ActiveXControl class.
Exceptions:
Exception
if there is an error when initializing the control.
NullPointerException
if clsid is null or if the IUnknown for the ActiveX control is not valid.
protected void createControl(IUnknown punk) throws Exception;
Creates an ActiveXControl object that is a container for an ActiveX control. This method hosts a control that has already been created.
Return Value:
No return value.
Parameter | Description |
punk
| The identity of the ActiveX control.
|
Remarks:
This method is used to defer the hosting of an ActiveX control, and is typically used when a control host was created using the ActiveXControl() constructor or when extending the ActiveXControl class.
Exceptions:
Exception
if there is an error when initializing the control.
NullPointerException
if punk is null.
protected void finalize() throws Throwable;
Removes the ActiveX control from memory. This method is called by the garbage collector.
Return Value:
No return value.
public Dimension getMinimumSize();
Retrieves the minimum size of the ActiveXControl object.
Return Value:
Returns the object's minimum size, which is the same as its preferred size, measured in pixels.
public Dimension getPreferredSize();
Retrieves the preferred size of the ActiveXControl object.
Return Value:
Returns the preferred width and height of the object, measured in pixels.
public boolean isFocusTraversable();
Tells the window manager that we want focus.
Return Value:
Returns true if the object is placed in the focus traversing list.
public synchronized void processComponentEvent(ComponentEvent event);
Processes the events from the component. It determines when the object has been resized, shown, or hidden.
Return Value:
No return value.
Parameter | Description |
event
| The ComponentEvent that was fired by the container.
|
public void processFocusEvent(FocusEvent event);
Processes focus events. When the focus is gained, the ActiveX control will become UI-active.
Return Value:
No return value.
Parameter | Description |
event
| The FocusEvent object that was fired by the window manager.
|
public void removeActiveXControlListener(ActiveXControlListener listener);
Removes an ActiveXControlListener object from the list of interested listeners. After this method is called, the component will no longer be notified on control hosting events.
Return Value:
No return value.
public void removeNotify();
Destroys the component's peer.
Warning You should never call this method directly.
Return Value:
No return value.
public void setBackground(Color c);
Sets the background color of the component. This method notifies the control that the background color has changed.
Return Value:
No return value.
Parameter | Description |
c
| The new color of the background.
|
public void setDesignMode(boolean b);
Tells the ActiveX control to go into design mode.
Return Value:
No return value.
Parameter | Description |
b
| The value that indicates whether the control should be notified that it is in design mode. If the value is true, the control is notified that the container is in design mode. If the value is false (the default), the container notifies the control that it is in run mode.
|
public void setFont(Font f);
Sets the font of the component. This method notifies the control that the font has changed.
Return Value:
No return value.
Parameter | Description |
f
| The new font.
|
public void setForeground(Color c);
Sets the foreground color of the component. This method notifies the control that the foreground color has changed.
Return Value:
No return value.
Parameter | Description |
c
| The new color of the foreground.
|
public void setProperty(String name, String value);
Sets a string property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The string value of the property.
|
public void setProperty(String name, int value);
Sets an integer property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The integer value of the property.
|
public void setProperty(String name, short value);
Sets a short integer property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The short integer value of the property.
|
public void setProperty(String name, boolean value);
Sets a boolean property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The boolean value of the property.
|
public void setProperty(String name, long value, int flag);
Sets a currency property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The value of the property.
|
flag
| Indicates how to set the property. If the value is CURRENCY, the property type is set to indicate currency; otherwise, the method returns without setting a property.
|
public void setProperty(String name, double value);
Sets a double property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The value of the property.
|
public void setProperty(String name, double value, int flag);
Sets a double or a date property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The double value of the property.
|
flag
| The value that determines how to set the property type. If the value is DATE, the property type is set to indicate a date; if the value is DOUBLE, the property type is set to indicate a double.
|
public void setProperty(String name, float value);
Sets a float property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property that is set.
|
value
| The float value of the property.
|
public void setProperty(String name, Variant value);
Sets a variant property of the ActiveX control.
Return Value:
No return value.
Parameter | Description |
name
| The name of the property to set.
|
value
| The value of the property.
|
Overrides:
setProperty(String,Variant) in ActiveXComponent.
public void showPropertyDialog();
Queries an ActiveX control for its property pages and displays the property dialog box.
Return Value:
No return value.
- CURRENCY
- Indicates the currency variant type.
- DATE
- Indicates the date variant type.
- DOUBLE
- Indicates the double variant type.