To show Dialog in Applet
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, May 5, 2001 01:38 AM

I am writing an Applet and creating java.awt.Dialog and making it show.while creating Dialog i am passing the owner as this object(it works fine when i am extending that class by java.awt.Frame) it is giving an error that no constructor matcing. CODE IS import java.awt.*; import java.applet.*; < aplet code="A.class" width=200 height=200> public class A extends Applet{ public void init(){ Dialog d=new Dialog(this,"sg",true); d.setBounds(20,30,100,100); d.show() } } this is giving compiler error .please give the solution    More>>

I am writing an Applet and creating java.awt.Dialog and
making it show.while creating Dialog i am passing
the owner as this object(it works fine when i am extending
that class by java.awt.Frame) it is giving an error that
no constructor matcing.
CODE IS

import java.awt.*;
import java.applet.*;
< aplet code="A.class" width=200 height=200>
public class A extends Applet{
public void init(){
Dialog d=new Dialog(this,"sg",true);
d.setBounds(20,30,100,100);
d.show()
}
}

this is giving compiler error .please give the solution

   <<Less

Re: To show Dialog in Applet

Posted By:   Finlay_McWalter  
Posted On:   Thursday, June 14, 2001 09:35 PM

This question is answered in the AWT FAQ at this page

Re: To show Dialog in Applet

Posted By:   Senavaraiyan_Dhanasekaran  
Posted On:   Tuesday, May 8, 2001 05:24 AM

Since You are using the Dialog, the constructor of the Dialog class will expect the First Parameter as a Frame or a Dialog. In this program you are extending the class from applet, so the this object will refer the class A as Applet, so only you are getting the Error. If you use the Frame, you won't get the error .If u use the Frame concepts you shouldn't use the init() method.
regards
Sena
About | Sitemap | Contact