Coders Packet

Creating Dialog Box using Java Applet

By Subhashree Dutta

This project is all about demonstrating a DailogBox using Java Applet, Java AWT and displaying the desired DialogDemo applet.

Hey Coders!! Hope everyone is doing well.

We have seen a lot of dialog boxes each time we work with any kind of software. We must have thought about creating one such by ourselves too.

In this project, we created a Dialog Box, selected one of the options, and displayed the result. Dialog boxes are mainly used to obtain input from users. The basic structure of a dialog box consists of a title and a border.

The commonly used constructors are:

  1. Dialog(Frame parentWindow, boolean mode)
  2. Dialog(Frame parentWindow, String title, boolean mode)

Where the parentWindow is the owner of the dialog box. If mode is true, a dialog box is said to be modal, otherwise modeless. The title of the box is passed in the title.

Also, this is a Java Applet based program. The java.applet package has the Applet class in it which is called at the time of execution. Applet has several methods that provide us control over the execution of our applet program. This kind of program runs on any web browser.

To run a Java Applet program in Command Prompt, the commands used:

  • javac filename.java
  • appletviewer filename.html

 

Below is the screenshot of the step by step output of the code after execution:

Download project

Reviews Report

Submitted by Subhashree Dutta (subhashree28)

Download packets of source code on Coders Packet