[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem with JApplet and Modal JDialog

Posted on 2001-09-05
3
Medium Priority
?
710 Views
Last Modified: 2008-02-01
Hi All,

I have problem with modal dialogs in a JApplet. The dialog
loose focus when I click on the parent applet. Then the dialog disappear behind Internet Explorer.

How to sovle this problem?

Thanks
nhp
0
Comment
Question by:nhphu
3 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 6456677
You can't, the JDialog event if is modal is not a system modal dialog, but a Java modal dialog. So the flag modal will not work "outside" a Java enviroinment.
0
 
LVL 16

Expert Comment

by:Valeri
ID: 6456913
Put this line in the constructor of your class that extends JDialog :

super(JOptionPane.getFrameForComponent(theparentComponent), "Title", true);

I hope it will help you.
best regards,
Valeri
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 30 total points
ID: 6457194
you have to use the appropriate parent Frame

try something like this

Frame modalFrame;
Component c = applet;
while ((c != null) && !(c instanceof Frame)) c = c.getParent();

if (c != null)
  modalFrame = (Frame)c;
else
  modalFrame = new Frame("dummy modal");
 
 
JDialog dialog = new JDialog(modalFrame, ...);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question