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;
}
}
------------------------------------------------------------------------
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;
}
}
------------------------------------------------------------------------
Comment