简体   繁体   中英

Why browsers crop java applet?

I created a Java applet supposed to be used in an applet as applets should.

For some reason, all browsers (chrome, firefox, IE) cut it.

Java applet的图像

I tried using the repaint() and invalidate() methods. I didn't help...

But, interestingly, when I scroll the browser up or down (even a tiny scroll), it immediately fixes. Also, when I use showOptionDialog(Component, String) method, if fixes after the user clicks the OK button on the dialog. It fixes only when the component inputted is the applet itself.

I don't understand why it crops, or how to fix it.

The HTML calling the applet it is very simple. Here is an example of a short piece of HTML code which causes the problem:

<html>
    <head>
        <title>nispahit</title>
    </head>
    <body>    
        <center>
            <APPLET CODE="Applet/AppletMain.class" archive="nnis.jar, log4j-1.2.16.jar" WIDTH=800 HEIGHT=600> 
                <param name="userName" value="http://www.nispahit.com/images/shalom.jpg"> 
                <param name="ColorsContrast" value="241026555"/>
                <param name="param2" value="14"> 
                <param name="param3" value="2"> 
                <param name="param3" value="2"> 
            </APPLET>
        </center>
    </body>
</html>

A solution or workaround will help very much. Any insight would also be helpful.

Thanks.

The cropping happens outside of the applet. There is some block element around the applet (usually a <div> ) which is too small to contain the whole applet.

Try to add a div with a red background around the applet so you can see quickly which part is rendered by the browser and which comes from the applet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM