Topic: 为什么我用eclipse运行这段程序显示结果什么都没有????

  Print this page

1.为什么我用eclipse运行这段程序显示结果什么都没有???? Copy to clipboard
Posted by: yqt
Posted on: 2005-09-06 15:50

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class ceishiApplet extends JApplet implements ActionListener {
     JLabel label1,label2,label3;
     JTextField text1,text2,text3;
    public void init(){
   label1=new JLabel("请输入长度");
   text1=new JTextField(10);
   label2=new JLabel("请输入宽度");
   text2=new JTextField(10);
   label3=new JLabel("面积");
   text3=new JTextField();
       getContentPane().add(label1);
       getContentPane().add(label2);
       getContentPane().add(label3);
       getContentPane().add(text1);
       getContentPane().add(text2);
       getContentPane().add(text3);
   text3.setEditable(false);
       text2.addActionListener(this);
    }

    public void actionPerformed(ActionEvent e) {
    // TODO 自动生成方法存根

    int c;
    if (e.getSource()==text2){
       int a, b;
       a=Integer.parseInt(text1.getText());
       b=Integer.parseInt(text2.getText());
      c=a*b;
      text3.setText(String.valueOfCoffee);       
    }
  }

}
大虾们给指点指点?????


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923