import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class p248_24 extends Applet implements ActionListener
{
   Button _1,_2,_3,_4,_5,_6,_7,_8,_9,_0;
   Button ad,min,mul,mult;
   Button clea,f;
   TextField _put;
   Panel p1,p2;
    public void init()
  {
    setLayout(new BorderLayout());
    p1 = new Panel();
    p2 = new Panel();
    _1 = new Button("1");
    _2 = new Button("2");
    _3 = new Button("3");
    _4 = new Button("4");
    _5 = new Button("5");
    _6 = new Button("6");
    _7 = new Button("7");
    _8 = new Button("8");
    _9 = new Button("9");
    _0 = new Button("0");
    ad = new Button("+");
    min = new Button("-");
    mul = new Button("*");
    mult = new Button("/");
    clea = new Button("清空");
    f = new Button("=");
    _put = new TextField(45);
    add("north",_put);
    add("west",p1);
    add("east",p2);
    p1.add(_1);
    p1.add(_2);
    p1.add(_3);
    p1.add(_4);
    p1.add(_5);
    p1.add(_6);
    p1.add(_7);
    p1.add(_8);
    p1.add(_9);
    p1.add(_0);
    p1.add(clea);
    p1.add(f);
    p1.setLayout(new GridLayout(5,5));
    p2.add(ad);
    p2.add(min);
    p2.add(mul);
    p2.add(mult);
    p2.setLayout(new GridLayout(4,1));
     ad.addActionListener(this);
    _1.addActionListener(this);
    _2.addActionListener(this);
    _3.addActionListener(this);
    _4.addActionListener(this);
    _5.addActionListener(this);  
    _6.addActionListener(this);
    _7.addActionListener(this);
    _8.addActionListener(this);
    _9.addActionListener(this);
    _0.addActionListener(this);
  }
 public void actionPerformed(ActionEvent e)
 { if(e.getSource()==ad)
       {}
  //_put.setText = "1"; 
 }}
原意是想做个计算器。这只是界面!编译通过了。。可是用APPLETVIEWER 却打不开
请各位看看