473,549 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dialog within applet hangs itself

Hello

Currently I'm migrating an applet from Java 1.1 to 1.3.

Targetplattform :
Microsoft Internet Explorer 5.x with Sun's Java VM 1.3.1

Problem:
The attached applet works fine with the Microsoft VM. But when I use
Suns' VM the applet hangs after opening the dialog. And you have to
shutdown the browser with the help of the Taskmanager.

Wenn ich das angef|gte Applet starte, funktioniert es in der M

Reason:
I was able to lead back the problem to the setVisible(true ) method of
the java.awt.Dialog class. This method does not return.

Question:
Does anything changed within the AWT from Java 1.1 to 1.3?

Thank you very much
Michael
--------------------------- TestDialog.java ---------------------------
/*
* TestDialog.java
*
* Created on 28. Oktober 2003, 09:04
*/

package ch.softlab.sebc ;

import java.awt.*;
import java.awt.event. *;

/**
*
* @author herrem
*/
public class TestDialog extends Dialog implements ActionListener,
WindowListener{

/** Creates a new instance of TestDialog */
private ActionListener listeners = null;

public TestDialog(Fram e frame) {
super(frame);
System.out.prin tln("TestDialog - constructor");

addWindowListen er(this);

TextField text = new TextField(10);

Button button = new Button("ok");
{
button.setActio nCommand("ok");
button.addActio nListener(this) ;
}
add(text, "Center");
add(button, "South");

pack();

setModal(true);
}

public void actionPerformed (java.awt.event .ActionEvent e) {
System.out.prin tln("TestDialog - actionPerformed ()");
fireActionEvent (new ActionEvent(thi s, e.getID(),
e.getActionComm and()));
}

public void fireActionEvent (ActionEvent e) {
if (listeners != null) {
listeners.actio nPerformed(e);
}
}

public void addActionListen er(ActionListen er actionlistener) {
listeners = AWTEventMultica ster.add(listen ers, actionlistener) ;
}

public void setVisible(bool ean flag) {
System.out.prin tln("TestDialog - setVisible() -> flag=" + flag);
if (flag) {
Dimension screensize =
Toolkit.getDefa ultToolkit().ge tScreenSize();
Dimension dimension = getSize();
setLocation( (screensize.wid th - dimension.width ) / 2,
(screensize.hei ght - dimension.heigh t) / 2 );
}
super.setVisibl e(flag);
}

public void windowClosing(W indowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(), "closing")) ;
}

public void windowActivated (WindowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(), "activated" ));
}

public void windowClosed(Wi ndowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(), "closed"));
}

public void windowDeactivat ed(WindowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(),
"deactivated")) ;
}

public void windowDeiconifi ed(WindowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(),
"deiconified")) ;
}

public void windowIconified (WindowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(), "iconified" ));
}

public void windowOpened(Wi ndowEvent e) {
actionPerformed (new ActionEvent(thi s, e.getID(), "opened"));
}

}

------------------------------------------------------------------------
--------------------------- FirstApplet.jav a ---------------------------
/*
* FirstApplet.jav a
*
* Created on 9. Oktober 2003, 15:51
*/

package ch.softlab.sebc ;

import java.applet.*;
import java.awt.*;

/**
*
* @author herrem
*/
public class FirstApplet extends Applet {

/** Initialization method that will be called after the applet is
loaded
* into the browser.
*/
private String _msg = "Hello World";

public void init() {
System.out.prin tln("FirstApple t - init()");
}

public void start() {
System.out.prin tln("FirstApple t - start()");
}

public void paint(Graphics g) {
System.out.prin tln("FirstApple t - paint()");
g.drawString(_m sg, 25, 50);
}

public void printEmpty() {
System.out.prin tln("FirstApple t - print()");
_msg = "print";
}

public void printString(Str ing msg) {
System.out.prin tln("FirstApple t - printString()") ;
_msg = msg;
}
}
------------------------------------------------------------------------
Jul 17 '05 #1
2 3475
Michael wrote:
Hello

Currently I'm migrating an applet from Java 1.1 to 1.3.

Targetplattform :
Microsoft Internet Explorer 5.x with Sun's Java VM 1.3.1

Problem:
The attached applet works fine with the Microsoft VM. But when I use
Suns' VM the applet hangs after opening the dialog. And you have to
shutdown the browser with the help of the Taskmanager.

Wenn ich das angef|gte Applet starte, funktioniert es in der M

Reason:
I was able to lead back the problem to the setVisible(true ) method of
the java.awt.Dialog class. This method does not return.

Question:
Does anything changed within the AWT from Java 1.1 to 1.3?


Michael,

My first instinct is that the dialog is somehow sized too small or
placed off the screen or is in some other way impossible to detect.
Since it is a modal dialog this might create the issue you are seeing.
Based on your code, it looks like you are OK in setting the size (via
pack()) and in setting the location (assuming the screen size is
reported properly). I recommend printing out what the dialog says its
size and location are before showing it (also, you may want to make it
non-modal, at least for debugging purposes).

Ray

Jul 17 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael wrote:
Reason:
I was able to lead back the problem to the setVisible(true ) method
of the java.awt.Dialog class. This method does not return.


Hello,
I'm not absolutely sure about setVisible(true ), but I know that show()
on a modal dialogue doesn't return until the dialogue is disposed.
setVisible(true ) may operate the same way. Maybe you need to display
the dialogue in a new thread, or maybe you need to reorganize your
code to take this into account.

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/pDSZwxczzJRavJY RAhjuAKCCqXkW/TAuYVcLxZl4/4/fq0d9SgCg7NS9
HtSK6b3hHddX/qrjvVrQ/6E=
=YC/E
-----END PGP SIGNATURE-----
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2454
by: WMMorgan | last post by:
There's a website I like to visit that has an user-interactive java application. There's a "visual applet" component and "control applet" component. (No, it's not an adult or porno site.) But the application isn't always usable because one or both of the applets have "failed," and has to be reset or something like that. I don't get it. ...
3
2887
by: Jeff T. | last post by:
I have an applet that sizes itself to the size of the browser frame that it is running in. On IE the applet resizes upon dragging the frame divider. I'm having a problem with getting this applet to resize itself when I resize the html frame if it's in Netscape 7.x. Seems like the problem is the lack of a refresh signal to the java applet...
2
3543
by: Jonathan | last post by:
Hi I'm doing a project for school and wrote an applet that makes a socket connection to a server (smae host as webserver) that was setup for this project. In the applet there are 3 buttons and by pressing one of them it triggers a specific query, like getting the server uptime, date or who (is online). The problem is that when I press one of...
4
15450
by: Warrick Wilson | last post by:
I've got a web page that uses frames. One of the frames loads an HTML page that redirects to a 3rd HTML page. This third page loads a Java applet - ProScroll.class - that runs a "news ticker" across part of my screen. The page is set up to refresh itself every 15 minutes using a <meta> tag. The idea is that the news ticker can pick up new...
2
12231
by: martin de vroom | last post by:
Hi, I have a web page that opens a modal dialog (client side) in the following manner onclick="window.showModalDialog('/dialog.asp',null,'dialogHeight: 200px; dialogWidth: 400px; dialogTop: 300px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;');"> and the page loads in the modal dialog no problem.
4
6220
by: dave | last post by:
I have an app that uses the OpenFile Dialog class. When I invoke the ShowDialog method, the hourglass appears and just stays. The dialog window never opens. I created a test form with an OpenFileDialog object in a new app, and it works fine. I then added that test form to the original project, and it no longer works. So far, the application is...
2
7352
by: MarkMurphy | last post by:
Is there a limitation in ASP.NET in this regard? From the aspx code below, I can successfully call a Java applet. If I try the identical thing in a user control ascx however, the control loads and hangs. The Java console offers no clues. The server serves the aspx page that contains the control, view source shows the expected html....
3
2868
by: Earl Teigrob | last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the Modal Box? I want to pop up a dialog box to the user and have it do its own post backs with validation checking and then save the data and close the dialog when the page is valid. I have read a little about using Iframes to post back to, but was wondering if this would...
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.