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
Andrey Kuznetsov - 15 Mar 2006 10:42 GMT
> 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() ?

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Sylvain - 15 Mar 2006 16:05 GMT
Thank you Andrey, here is the information :
myApplet.getParent().getClass().getName() is sun.applet.AppletViewerPanel
and its superclass is sun.applet.AppletPanel.
Sylvain
>> how to open a modal dialog from an applet ?
>>
[quoted text clipped - 4 lines]
>
> what returns myApplet.getParent().getClass().getName() ?
Paul Hamaker - 15 Mar 2006 15:36 GMT
Use new JFrame, as shown here :
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=odl&sub=gui
--------------------
Paul Hamaker, SEMM, teaching ICT since 1987
http://javalessons.com
Sylvain - 15 Mar 2006 15:57 GMT
Thank you Paul but the dialog on the example is not modal in my Intenet
Explorer.
Sylvain
> Use new JFrame, as shown here :
> http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=odl&sub=gui
> --------------------
> Paul Hamaker, SEMM, teaching ICT since 1987
> http://javalessons.com
Thomas Hawtin - 15 Mar 2006 18:55 GMT
> 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

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Sylvain - 16 Mar 2006 10:42 GMT
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
> Hi !
>
[quoted text clipped - 13 lines]
>
> Sylvain Caillet