Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog Owner

Status
Not open for further replies.

kohinoor2007

Programmer
Mar 21, 2007
69
0
0
DE
Hi all,

Iam developing an applet ...

My applet is derived from the Swing JApplet.

Iam creating a custom dialog as follows from within my applet.

public class MyDialog extends JDialog
{

public MyDialog(JDialog owner,String title,boolean modal){

super(owner,title,modal);


}
}

Now my question is,what should I pass as 1st parameter to the MyDialog Constructor...

From Applet,I call somethings as

MyDialog test = new MyDialog((JDialog)getParent(),"test",true);

But casting to "JDialog" fails....

What is the best way to do the casting....

I want this dialog to be visible in the centre of my applet.....

Thanks in advance.....
 
Why are you overriding JDialog? Isn't enough a regular JDialog? What is getParent() referred to? Can't you just use the JApplet's frame?

Cheers,
Dian
 
getParent"is a JApplet member function which returns a type Container.

Okay,JDialogs constructor either takes a JDialog or JFrame as owner parameter.

Does the "JApplet's frame"return a JFrame.How will I get it from the JApplet.Is there any member function in JApplet for that....
 
Thanks,It worked.But its not appearing in the centre of the applet.

Any way to do that....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top