?
Solved

Problem with JApplet and Modal JDialog

Posted on 2001-09-05
3
Medium Priority
?
707 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 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