i tried the following code but not getting the desired output. I need to extend Applet class along with dialog class.how do i do that?

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="YesNoDialog" width=400 height=400></applet>*/
public class YesNoDialog extends  Dialog implements ActionListener
{
private Button yes=new Button("Yes");
private Button no=new Button("No");

public YesNoDialog(Frame parent,String message)
{
super(parent,true);
this.add(BorderLayout.CENTER,new Label(message));
Panel p=new Panel();
p.setLayout(new FlowLayout());
yes.addActionListener(this);
p.add(yes);
no.addActionListener(this);
p.add(no);
this.add(BorderLayout.SOUTH,p);
this.setSize(300,100);
this.setLocation(100,200);
this.pack();
}
public void actionPerformed(ActionEvent evt)
{
this.hide();
this.dispose();
}
}

As start work use this templates

import javax.swing.JApplet;

public class YesNoDialog extends JApplet {

    /**
     * Initialization method that will be called after the applet is loaded
     * into the browser.
     */
    public void init() {
        // TODO start asynchronous download of heavy resources
    }

    // TODO overwrite start(), stop() and destroy() methods

}

or

import java.applet.Applet;

public class YesNoDialog extends Applet {

    /**
     * Initialization method that will be called after the applet is loaded
     * into the browser.
     */
    public void init() {
        // TODO start asynchronous download of heavy resources
    }

    // TODO overwrite start(), stop() and destroy() methods
}

why? - read docs.
You can write another class

public class OwnDialog extends  Dialog implements ActionListener{
/...
}

and use it.
Look at Sun examples inside JDK directory...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.