简体   繁体   English

如何在HTML中调整小程序的大小

[英]How to adjust the size of an applet in html

I have a code that needs user input of 3 floating numbers and calculate the sum, multiplication, min, max and average. 我有一个需要用户输入3个浮点数的代码,并计算总和,乘法,最小值,最大值和平均值。 I have successfully made a display in the html. 我已经在html中成功显示了内容。 However the size is not what I wanted. 但是大小不是我想要的。 In my computer it shows up like this after resizing the window: 在我的计算机中,调整窗口大小后,它显示如下: 在此处输入图片说明

However the html code shows up in my browser like: 但是,html代码会在我的浏览器中显示,例如: 在此处输入图片说明

The display size is different. 显示尺寸不同。

My code for displaying the panel is like below: 我显示面板的代码如下:

public void paint(Graphics g)
{
    super.paint(g);
    g.drawRect(15, 10, 400, 180);
    g.drawString(String.format("The numbers entered are: %.3f, %.3f, %.3f", number1, number2, number3), 25, 25);
    g.drawString( "The count is 3", 25, 50);
    g.drawString(String.format("The sum is: %.3f",sum), 25, 75);
    g.drawString(String.format("The product is: %.3f",product), 25, 100);
    g.drawString(String.format("The average is: %.3f",average), 25, 125);
    g.drawString(String.format("The largest absolute value is: %.3f",max), 25, 150);
    g.drawString(String.format("The smallest absolute value is: %.3f",min), 25, 175);
}

And my html code for writing applet container is below: 我的用于编写applet容器的html代码如下:

 <html>
 <body>
 <applet code = "calculator.class" width="400" height="100">
 </applet>
 </body>
 </html>

what is wrong? 怎么了?

I changed the size of applet container to 我将小程序容器的大小更改为

<applet code = "calculator.class" width="600" height="300">

And it worked well. 而且效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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