Solved

JFrame/JDialog Browser problem

Posted on 2000-02-17
6
953 Views
Last Modified: 2013-11-23
We're developming a Java applet which uses swing components.  Here's the basic gist of how it works.  When the applets starts, it generates a JFrame which basically displays online database information.  The JFrame should work in theory like this:  when the default close operation is called (x box in the upper right corner of the frame is clicked) a JDialog box appears and asks for confirmation.  If "yes" is clicked, both frames should close.

In reality - when the default close operation is called the JDialog box appears, however when "yes" is clicked the Dialog box disappears and then reappears a few seconds later as well as the main frame.  We can't get either to disappear.  This only occurs when the applet is run under a browser.  It does not happen when run under Visual Age for Java.  Anybody have any ideas what the problem is and how it could be fixed?

Thanks.  
0
Comment
Question by:CatDevlp00
6 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 2532580
post your code (the problem is in YOUR code :)
0
 

Author Comment

by:CatDevlp00
ID: 2532679
Sorry, there's way too much code handling these events for it to be posted here at this time.  I was wondering if there was a JFrame - browser bug.  If not, I'll see if I can whittle the code down to a managable portion to be posted here.  Thanks.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2532745
JFrame is just java.awt.Frame + some additional code (double buffering etc.)
all you have to do is capture the WindowClosing event and hide your Frame.

you may want to add some System.out.println() + Thread.dumpStack() to Frame's show() / hide() & setVisible() methods, so that you can track who and when calls these methods)

0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 8

Expert Comment

by:diakov
ID: 2534014
Make a small example that reproduces the bug. Just strip down all unrelated to the frame stuff, run it, then post it here.

I could only guess, but may b you do initialization of your frame in the start() method, and start is called quite often from the browser. move all GUI initializations to the init() of the applet.

Cheers,
  Nik
0
 

Accepted Solution

by:
108093233315 earned 75 total points
ID: 2534060
1.) Call the following method of your JFrame:

myFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);


2.) Use

JOptionPane.showConfirmDialog(Component parentComponent, Object message, String title, int optionType)

instead of JDialog.
0
 

Author Comment

by:CatDevlp00
ID: 2542625
Adjusted points to 75
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error trying to install RTMT Win7 5 60
reverse digits of a number using for loop 5 42
login form jsp example 2 26
Java: The Public Class Main 4 17
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

809 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