Modal dialog from an applet

S

Sylvain

Hi !

I really need for today an answer to a problem which seems to be simple :
how to open a modal dialog from an applet ?

Before java 1.5, i did it by creating a JDialog with the frame owner :
(Frame)myApplet.getParent(), but this doesn't work anymore ! The cast is now
false (in Internet Explorer 6).

If anybody has an idea, it would be great !!

Thank you all

Best regards

Sylvain Caillet
 
A

Andrey Kuznetsov

how to open a modal dialog from an applet ?
Before java 1.5, i did it by creating a JDialog with the frame owner :
(Frame)myApplet.getParent(), but this doesn't work anymore ! The cast is
now
false (in Internet Explorer 6).

what returns myApplet.getParent().getClass().getName() ?
 
S

Sylvain

Thank you Andrey, here is the information :

myApplet.getParent().getClass().getName() is sun.applet.AppletViewerPanel
and its superclass is sun.applet.AppletPanel.

Sylvain
 
T

Thomas Hawtin

Sylvain said:
I really need for today an answer to a problem which seems to be simple :
how to open a modal dialog from an applet ?

Before java 1.5, i did it by creating a JDialog with the frame owner :
(Frame)myApplet.getParent(), but this doesn't work anymore ! The cast is now
false (in Internet Explorer 6).

That's a hack and modal dialog boxes are evil.

However, I believe applet.getParent().getParent() will give you the Frame.

Tom Hawtin
 
S

Sylvain

Thank you all. I had a solution for both the AppletViewer and Internet
Explorer. I'm not sure it's ok for firefox.
The solution is to fin the
(Frame)SwingUtilities.getAncestorOfClass(Frame.class, myApplet) and use it
as owner for the dialog.

Sylvain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top