简体   繁体   English

我的第一个小程序什么也没显示

[英]My first applet shows nothing

I am trying to run this applet code below.But When I run it .I just get an empty Applet screen that says applet started. 我正在尝试在下面运行此applet代码。但是当我运行它时,我只得到一个空的applet屏幕,显示applet已启动。

public class Ass extends JApplet{
    double sum;
    public void init(){
        double  D1=Double.parseDouble(JOptionPane.showInputDialog("firstvAL"));
        double D2=Double.parseDouble(JOptionPane.showInputDialog("secondvAL"));
        sum=D1+D2;
    }

    @Override
    public void print(Graphics g) {
        // TODO Auto-generated method stub
        super.print(g);
        g.drawString("Sum is"+sum,44,44);
    }

}

And I want to ask one more thing.I have removed eclips ide and downloaded Enterprice edition .And noticed these two section .Why is that? 我想再问一件事。我已经删除了eclips ide并下载了Enterprice版本。注意到这两个部分。为什么呢? did I make a mistake while removing eclipse folder 删除eclipse文件夹时我弄错了吗

在此处输入图片说明

我认为您应该使用paint ( )而不是print ( )

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

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