Dialog Class Assignment Help

Assignment Help: >> AWT GUI Components - Dialog Class

Dialog Class:

The dialog class is a subclass of the window class.  A class declares an optionally user resizable and movable top-level window along with a title bar.  A Dialog box will not have menu bar and an icon.  The dialog window could direct all input to its window until it is dismissed.

The Dialog class hold various constructors

Dialog(Frame parent)

Dialog(Frame parent, boolean modal)

Dialog(Frame parent, String title)

Dialog(Frame parent, Stirng title, boolean model)

 

All the constructors make an initially invisible dialog box.

//create a child frame window

import java.awt.*.;

import java.awt.event.*;

import java.applet.*;

/* <applet code = "Applet Frame" width = 300 height = 50>

</applet>

*/

//create a subclass of Frame

class SampleFrame extends Frame

{

SampleFrame(Strint title)

{

super(title);

// create an object

MyWindowAdapter adapter = new MyWindowAdapter (this);

// register it to receive those events. addWindowListener(adapter);

}

public void paint ( Graphics g)

{

g.drawstring("this is in frame window",20,40);

}

}

class MyWindowAdapter extends WindowAdapter

{

SampleFrame sampleFrame;

public MyWindowAdapter(SampleFrame sampleFrame)

{

this.sampleFrame = sampleFrame;

}

public void windowClosing(WindowEvent we)

{

sampleFrame.setVisible(false);

}

}

// creat frame window

public class AppletFrame extends Applet

{

Frame f;

public void init( )

{

f = new SampleFrame("A frame window");

f .setSize(250,250);

f.setVisible(true):

}

public void start( )

{

f.setVisible(true);

}

public void stop ( )

{

f.setVisible(false);

}

public void paint (Graphics g)

{

g.drawstring("this is an applet " 20, 30);

}

}

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd