Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Modal dialog from an applet

Thread view: 
Sylvain - 15 Mar 2006 10:04 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.