Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIAwtHost

public class UIAwtHost extends UICanvas
{
  // Constructors
  public UIAwtHost(Component comp);

  // Methods
  public Component getComponent();
  public boolean postEvent(Event e);
}

This class is an AWT host control that enables AWT-based components to be used in AFC containers. The following example shows how to use the AWT host to include an AWT Button object in a UIPanel object.

// Create an AFC panel and an AWT button.
UIPanel p = new UIPanel ();
Button b = new Button ("AWT Button");

// Add button to panel using UIAwtHost bridge.
p.add (new UIAwtHost (b));

Events propagating to the host control are re-targeted before being propagated up the containment hierarchy, so the host becomes the target for these events. The host control supports event propagation for only one level of containment. Events associated with any components contained by the component being hosted are consumed by the host control and do not propagate further. To catch these events, you must override the postEvent method. UIAwtHost will not propagating any events whose target is an AWT component and not the component being hosted.

Note The UIAwtHost control cannot be used inside an AFC choice (UIChoice) control. If used inside a menu list (UIMenuList), the menu list cannot be launched as a pop-up menu.

UIComponent
  |
  +--UIStateComponent
    |
    +--UICanvas
      |
      +--UIAwtHost

Constructors

UIAwtHost

public UIAwtHost(Component comp);

Creates an AWT host control from the specified AWT component.

ParameterDescription
comp The AWT component to be hosted.

Methods

getComponent

public Component getComponent();

Retrieves the AWT component hosted by the AWT host control.

Return Value:

Returns the component.

postEvent

public boolean postEvent(Event e);

Determines if the target of the event is a Component; otherwise, passes the event up to the parent, UIComponent.postEvent.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event.

See Also: com.ms.ui.UIComponent.postEvent

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