-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.0
-
sparc
-
solaris_2.4
When using the appletviewer, the applet's call to
Component.resize() is apparently ignored. The size of the
applet is the size of the appletviewer window, which is
initially set from parameters of the <applet> tag.
This could be confusing for applets that think they know
and control their own dimensions, as for example, those
that handle mouse clicks or that expecte widget layout to
combine with other graphics.
Here is a simple html page and java code
----- resizer.html --------
<html>
<body>
<hr>
<applet code="Resizer.class" height=200 width=500>
</applet>
<hr>
</body>
</html>
---- Resizer.java -------------
import java.awt.*;
import java.applet.Applet;
import java.applet.AppletContext;
public class Resizer extends java.applet.Applet {
private static final int
height = 50,
width = 75;
private AppletContext c;
public void init(){
c = getAppletContext();
resize( width, height );
repaint();
}
public void paint( Graphics g ){
Rectangle r = bounds();
g.drawRect( 0, 0, r.width-1, r.height-1 );
c.showStatus("Size is "+r.width+" w. by "+r.height+" h.");
}
}
Component.resize() is apparently ignored. The size of the
applet is the size of the appletviewer window, which is
initially set from parameters of the <applet> tag.
This could be confusing for applets that think they know
and control their own dimensions, as for example, those
that handle mouse clicks or that expecte widget layout to
combine with other graphics.
Here is a simple html page and java code
----- resizer.html --------
<html>
<body>
<hr>
<applet code="Resizer.class" height=200 width=500>
</applet>
<hr>
</body>
</html>
---- Resizer.java -------------
import java.awt.*;
import java.applet.Applet;
import java.applet.AppletContext;
public class Resizer extends java.applet.Applet {
private static final int
height = 50,
width = 75;
private AppletContext c;
public void init(){
c = getAppletContext();
resize( width, height );
repaint();
}
public void paint( Graphics g ){
Rectangle r = bounds();
g.drawRect( 0, 0, r.width-1, r.height-1 );
c.showStatus("Size is "+r.width+" w. by "+r.height+" h.");
}
}