AWT Controls-AWT Dialog Class - AWT (Abstract Window Toolkit)

What is the use of AWT Dialog Class?

Introduction

Dialog control signifies a top-level window with a title and a border used to take some form of input from the user.

Class declaration

Below is the declaration for java.awt.Dialog class:

Field

Below are the fields for java.awt.Image class:

  • static Dialog.ModalityType DEFAULT_MODALITY_TYPE -- Default modality type for modal dialogs.

Class constructors

S.N.

Constructor & Description

1

Dialog(Dialog owner)

Constructs an initially invisible, modeless Dialog with the specified owner Dialog and an empty title.

2

Dialog(Dialog owner, String title)

Constructs an initially invisible, modeless Dialog with the specified owner Dialog and title.

3

Dialog(Dialog owner, String title, boolean modal)

Constructs an initially invisible Dialog with the specified owner Dialog, title, and modality.

4

Dialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)

Constructs an initially invisible Dialog with the specified owner Dialog, title, modality and GraphicsConfiguration.

5

Dialog(Frame owner)

Constructs an initially invisible, modeless Dialog with the specified owner Frame and an empty title.

6

Dialog(Frame owner, boolean modal)

Constructs an initially invisible Dialog with the specified owner Frame and modality and an empty title.

7

Dialog(Frame owner, String title)

Constructs an initially invisible, modeless Dialog with the specified owner Frame and title.

8

Dialog(Frame owner, String title, boolean modal)

Constructs an initially invisible Dialog with the specified owner Frame, title and modality.

9

Dialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)

Constructs an initially invisible Dialog with the specified owner Frame, title, modality, and GraphicsConfiguration.

10

Dialog(Window owner)

Constructs an initially invisible, modeless Dialog with the specified owner Window and an empty title.

11

Dialog(Window owner, Dialog.ModalityType modalityType)

Constructs an initially invisible Dialog with the specified owner Window and modality and an empty title.

12

Dialog(Window owner, String title)

Constructs an initially invisible, modeless Dialog with the specified owner Window and title.

13

Dialog(Window owner, String title, Dialog.ModalityType modalityType)

Constructs an initially invisible Dialog with the specified owner Window, title and modality.

14

Dialog(Window owner, String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc)

Constructs an initially invisible Dialog with the specified owner Window, title, modality and GraphicsConfiguration

Class methods

S.N.

Method & Description

1

void addNotify()

Makes this Dialog displayable by connecting it to a native screen resource.

2

AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this Dialog.

3

Dialog.ModalityType getModalityType()

Returns the modality type of this dialog.

4

String getTitle()

Gets the title of the dialog.

5

void hide()

Deprecated. As of JDK version 1.5, replaced by setVisible(boolean).

6

boolean isModal()

Indicates whether the dialog is modal.

7

boolean isResizable()

Indicates whether this dialog is resizable by the user.

8

boolean isUndecorated()

Indicates whether this dialog is undecorated.

9

protected String paramString()

Returns a string representing the state of this dialog.

10

void setModal(boolean modal)

Specifies whether this dialog should be modal.

11

void setModalityType(Dialog.ModalityType type)

Sets the modality type for this dialog.

12

void setResizable(boolean resizable)

Sets whether this dialog is resizable by the user.

13

void setTitle(String title)

Sets the title of the Dialog.

14

void setUndecorated(boolean undecorated)

Disables or enables decorations for this dialog.

15

void setVisible(boolean b)

Shows or hides this Dialog depending on the value of parameter b.

16

void show()

Deprecated. As of JDK version 1.5, replaced by setVisible(boolean).

17

void toBack()

If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.

Methods inherited

This class inherits methods from the following classes:

  • java.awt.Window
  • java.awt.Component
  • java.lang.Object

Dialog Example

Create the following java program using any editor of your choice in say D:/ > AWT > com > wisdomjobs > gui >

AwtControlDemo.java

Compile the program using command prompt. Go to D:/ > AWT and type the following command.

If no error comes that means compilation is successful. Run the program using following command.

Verify below output

awt_dialog

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

AWT (Abstract Window Toolkit) Topics