简体   繁体   中英

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.

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? did I make a mistake while removing eclipse folder

在此处输入图片说明

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

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