When bring up an applet window from appletviewer through a web server, the window doubles itself with two areas show up side by side - left one with the yellow "Warning: Applet Window" bar and right one with the string message. Test case includes TestWindow.java and test.html.
/* TestWindow.java */
import java.awt.*;
import java.applet.*;
public class TestWindow extends Applet
{
Window w;
Frame f;
public void init()
{
f = new Frame("this is a frame");
w = new myWindow(f);
w.setLocation(300, 200);
w.setSize(300,100);
w.setVisible(true);
}
public class myWindow extends Window
{
myWindow(Frame parent)
{
super(parent);
}
public void paint(Graphics g)
{
g.drawString("this is a window with a warning message", 20, 30);
}
}
}
test.html -
<HTML>
<HEAD>
<TITLE>Testing Window</TITLE>
</HEAD>
<BODY BGCOLOR="#000066" TEXT="#FFFFFF" link="aqua" vlink="lime">
<CENTER>
Testing Window<P>
<hr>
<applet code=TestWindow.class width=200 height=200>
</applet>
<hr>
/* TestWindow.java */
import java.awt.*;
import java.applet.*;
public class TestWindow extends Applet
{
Window w;
Frame f;
public void init()
{
f = new Frame("this is a frame");
w = new myWindow(f);
w.setLocation(300, 200);
w.setSize(300,100);
w.setVisible(true);
}
public class myWindow extends Window
{
myWindow(Frame parent)
{
super(parent);
}
public void paint(Graphics g)
{
g.drawString("this is a window with a warning message", 20, 30);
}
}
}
test.html -
<HTML>
<HEAD>
<TITLE>Testing Window</TITLE>
</HEAD>
<BODY BGCOLOR="#000066" TEXT="#FFFFFF" link="aqua" vlink="lime">
<CENTER>
Testing Window<P>
<hr>
<applet code=TestWindow.class width=200 height=200>
</applet>
<hr>
- duplicates
-
JDK-4155700 "warning: applet window" doubles itself and displays message in the extra area
- Closed