Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.activeX   Previous This
Package
Next

 


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

Constructors

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.

ActiveXControl

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).

ParameterDescription
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.

ActiveXControl

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.

ParameterDescription
punk The identity of the ActiveX control.

Methods

activate

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.

activateNoGUI

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.

addActiveXControlListener

public void addActiveXControlListener(ActiveXControlListener listener);

Adds an ActiveXControlListener object that listens to events sourced by the ActiveXControl class.

Return Value:

No return value.

ParameterDescription
listener The ActiveXControlListener object that will sink events.

createControl

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.

ParameterDescription
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.

createControl

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.

ParameterDescription
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.

finalize

protected void finalize() throws Throwable;

Removes the ActiveX control from memory. This method is called by the garbage collector.

Return Value:

No return value.

getMinimumSize

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.

getPreferredSize

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.

isFocusTraversable

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.

processComponentEvent

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.

ParameterDescription
event The ComponentEvent that was fired by the container.

processFocusEvent

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.

ParameterDescription
event The FocusEvent object that was fired by the window manager.

removeActiveXControlListener

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.

ParameterDescription
listener The ActiveXControlListener object that will be removed.

removeNotify

public void removeNotify();

Destroys the component's peer.

Warning You should never call this method directly.

Return Value:

No return value.

setBackground

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.

ParameterDescription
c The new color of the background.

setDesignMode

public void setDesignMode(boolean b);

Tells the ActiveX control to go into design mode.

Return Value:

No return value.

ParameterDescription
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.

setFont

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.

ParameterDescription
f The new font.

setForeground

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.

ParameterDescription
c The new color of the foreground.

setProperty

public void setProperty(String name, String value);

Sets a string property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The string value of the property.

setProperty

public void setProperty(String name, int value);

Sets an integer property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The integer value of the property.

setProperty

public void setProperty(String name, short value);

Sets a short integer property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The short integer value of the property.

setProperty

public void setProperty(String name, boolean value);

Sets a boolean property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The boolean value of the property.

setProperty

public void setProperty(String name, long value, int flag);

Sets a currency property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
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.

setProperty

public void setProperty(String name, double value);

Sets a double property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The value of the property.

setProperty

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.

ParameterDescription
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.

setProperty

public void setProperty(String name, float value);

Sets a float property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property that is set.
value The float value of the property.

setProperty

public void setProperty(String name, Variant value);

Sets a variant property of the ActiveX control.

Return Value:

No return value.

ParameterDescription
name The name of the property to set.
value The value of the property.

Overrides:

setProperty(String,Variant) in ActiveXComponent.

showPropertyDialog

public void showPropertyDialog();

Queries an ActiveX control for its property pages and displays the property dialog box.

Return Value:

No return value.

Fields

CURRENCY
Indicates the currency variant type.
DATE
Indicates the date variant type.
DOUBLE
Indicates the double variant type.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.