Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIDialog

public class UIDialog extends UIWindow
{
  // Constructors
  public UIDialog(UIFrame parent);
  public UIDialog(UIFrame parent, boolean modal);
  public UIDialog(UIFrame parent, String title);
  public UIDialog(UIFrame parent, String title, boolean modal);

  // Methods
  public void adjustLayoutSize(IUIComponent comp,
        Dimension oldSize, Dimension newSize);
  public void dispose();
  public Point getPosition();
  public String getTitle();
  public boolean handleEvent(Event evt);
  public boolean isAutoPack();
  public boolean isModal();
  public boolean keyDown(Event e, int key);
  public boolean keyUp(Event e, int key);
  public void position(boolean resizable);
  public void setAutoPack(boolean b);
  public void setModal(boolean b);
  public void setName(String name);
  public void setPosition(Point p);
  public void setResizable(boolean resizable);
  public void setTitle(String title);
  public void show();
}

This class implements a dialog window. UIDialog extends the UIWindow class and uses UIHost and UIRootContainer to link with the Application Foundation Classes (AFC). Each UIDialog object has an associated java.awt host (a UIHost object) that delegates method calls to an AFC root container (a UIRootContainer object). When the dialog window is created, the host is added to the window, which in turn displays the root container. The root container allows the dialog window to display IUIComponent objects.

Note All event and paint notifications sent from AWT to the dialog window are also received by the host, which is a child component of the window. The host then routes these notifications to the root container.

A dialog window is initially hidden when it is first created. You must call the dialog window's show method to make the window visible.

Caution The dispose method must be called after any instance of UIDialog, especially after calling show.

UIWindow events are supported.

Note Classes that extend UIDialog and implement the TimerListener interface must call the super method TimerTriggered(event).

Also see com.ms.ui.UIWindow, com.ms.ui.event.IUIMouseListener, com.ms.util.TimerListener, setAutoPack

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UIPanel
        |
        +--UIRoot
          |
          +--UIWindow
            |
            +--UIDialog

Constructors

UIDialog

public UIDialog(UIFrame parent);

Creates a modeless dialog window using the specified parent frame. The dialog window has no title.

ParameterDescription
parent The parent frame of the dialog window.

Remarks:

By default, the dialog window uses BorderLayout for its layout manager. The host is then added to the center of the dialog window, and the root container is displayed. Initially, the root container is empty; to add components, call add. By default, the root container uses UIBorderLayout for its layout manager.

Note The dialog window is initially hidden. You must call the dialog window's show method to make the window visible.

For more information about the root container, see the UIDialog overview.

See Also: com.ms.ui.IUIContainer.setLayout

UIDialog

public UIDialog(UIFrame parent, boolean modal);

Creates a modeless or modal dialog window using the specified parent frame. The dialog window has no title.

ParameterDescription
parent The parent frame of the dialog window.
modal If true, the dialog window is modal (meaning no other window can receive input while this window is visible); otherwise, the dialog window is modeless.

Remarks:

By default, the dialog window uses BorderLayout for its layout manager. The host is then added to the center of the dialog window, and the root container is displayed. Initially, the root container is empty; to add components, call add. By default, the root container uses UIBorderLayout for its layout manager.

Note The dialog window is initially hidden. You must call the dialog window's show method to make the window visible.

For more information about the root container, see the UIDialog overview.

See Also: com.ms.ui.IUIContainer.setLayout

UIDialog

public UIDialog(UIFrame parent, String title);

Creates a modeless dialog window using the specified parent frame and title.

ParameterDescription
parent The parent frame of the dialog window.
title The title of the dialog window.

Remarks:

By default, the dialog window uses BorderLayout for its layout manager. The host is then added to the center of the dialog window, and the root container is displayed. Initially, the root container is empty; to add components, call add. By default, the root container uses UIBorderLayout for its layout manager.

Note The dialog window is initially hidden. You must call the dialog window's show method to make the window visible.

For more information about the root container, see the UIDialog class overview.

See Also: com.ms.ui.IUIContainer.setLayout

UIDialog

public UIDialog(UIFrame parent, String title, boolean modal);

Creates a modeless or modal dialog window using the specified parent frame and title.

ParameterDescription
parent The parent frame of the dialog window.
title The title of the dialog window.
modal If true, the dialog window is modal (meaning no other window can receive input while this window is visible); otherwise, the dialog window is modeless.

Remarks:

By default, the dialog window uses BorderLayout for its layout manager. The host is then added to the center of the dialog window, and the root container is displayed. Initially, the root container is empty; to add components, call add. By default, the root container uses UIBorderLayout for its layout manager.

Note The dialog window is initially hidden. You must call the dialog window's show method to make the window visible.

For more information about the root container, see the UIDialog class overview.

See Also: com.ms.ui.IUIContainer.setLayout

Methods

adjustLayoutSize

public void adjustLayoutSize(IUIComponent comp, Dimension oldSize,
        Dimension newSize);

Adjusts the layout size of the component. This method calls adjustLayoutSize.

Return Value:

No return value.

ParameterDescription
comp The component to be adjusted.
oldSize The old size of the component.
newSize The new size of the component.

Remarks:

If isAutoPack is set to true, pack is called.

dispose

public void dispose();

Called when the UIDialog component is no longer needed and can be disposed of.

Return Value:

No return value.

getPosition

public Point getPosition();

Retrieves the position of the dialog window.

Return Value:

Returns a Point object containing the upper-left corner of the dialog window.

See Also: setPosition

getTitle

public String getTitle();

Retrieves the title of the UIDialog box.

Return Value:

Returns a String that contains the title of the dialog box.

See Also: setTitle

handleEvent

public boolean handleEvent(Event evt);

Responds to events occurring within the control.

Return Value:

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

ParameterDescription
evt The event.

isAutoPack

public boolean isAutoPack();

Determines if the components in a window will be packed. Returns true or false, depending on whether the components in the container will be packed.

Return Value:

Returns true if the components in the window will be packed; otherwise, returns false.

See Also: setAutoPack, com.ms.ui.UIWindow.pack

isModal

public boolean isModal();

Gets the modality of the dialog box.

Return Value:

Returns true if the dialog is modal; otherwise, returns false.

See Also: setModal

keyDown

public boolean keyDown(Event e, int key);

Called, usually by the handleEvent method, when a key is pressed.

Return Value:

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

ParameterDescription
e The event that caused the call to the keyDown.
key The ASCII value of the key that was pressed.

Remarks:

If the ESC key has been pressed, it is handled locally in keyUp where the window will be closed. If it is any other key, it is handled in the superclass keyDown method. See the similar UIMessageBox method which checks for enter or space keys,

See Also: keyUp, com.ms.ui.UIMessageBox.keyUp

keyUp

public boolean keyUp(Event e, int key);

Called, usually by the handleEvent method, when a key is pressed.

Return Value:

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

ParameterDescription
e The event that caused the call to keyUp.
key The ASCII value of the key released.

Remarks:

If the ESC key has been pressed and the component is not a modal message box, the component will be made invisible. Otherwise the event will be handled by the superclass keyUp method. See the similar UIMessageBox.keyUp method which checks for enter or space keys,

position

public void position(boolean resizable);

Positions the dialog window on the screen.

Return Value:

No return value.

ParameterDescription
resizable If true, the dialog window can be resized; otherwise its size is fixed.

Remarks:

If a point was set through setPosition, this method positions the dialog window based on the coordinates of this point. Otherwise, the window is centered on the screen.

setAutoPack

public void setAutoPack(boolean b);

Sets the automatic packing feature.

Return Value:

No return value.

ParameterDescription
b boolean. Toggles an internal flag that determines whether the components in a container will be packed or not. Set this variable to true, if components are to be packed; false otherwise.

See Also: getPosition, isAutoPack, com.ms.ui.UIWindow.pack

setModal

public void setModal(boolean b);

Sets the modality of the dialog box.

Return Value:

No return value.

ParameterDescription
b Set this to true if the dialog box is modal.

See Also: isModal

setName

public void setName(String name);

Sets the dialog box's name and title. Calls UIPanel.setName and setTitle.

Return Value:

No return value.

ParameterDescription
name The name to be associated with the container.

See Also: getName

setPosition

public void setPosition(Point p);

Sets the position of the dialog window, based on the specified point.

Return Value:

No return value.

ParameterDescription
p The coordinates for the upper-left corner of the dialog window.

Remarks:

This method only marks the new position for the dialog window. The position method actually repositions the window based on the specified point.

See Also: getPosition

setResizable

public void setResizable(boolean resizable);

Sets the resizable flag.

Return Value:

No return value.

ParameterDescription
resizable Set to true if the dialog can be resized; otherwise, set to false.

setTitle

public void setTitle(String title);

Sets the title of the dialog box.

Return Value:

No return value.

ParameterDescription
title The new title set for the dialog box.

See Also: getTitle

show

public void show();

Shows the applet and its root container.

Return Value:

No return value.

Overrides:

show() in UIWindow.

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