本帖最后由 c09034120207 于 2011-05-08 15:17:52 编辑

解决方案 »

  1.   

    bAdd.addActionListener(new setLabelText_ActionListener());
    bDec.addActionListener(new setLabelText_ActionListener());
    bMul.addActionListener(new setLabelText_ActionListener());
    bDiv.addActionListener(new setLabelText_ActionListener());
    bCal.addActionListener(new setLabelText_ActionListener());
    按钮的监听器加错了吧应该用这个setOperator_ActionListener吧
      

  2.   

    能不能详细一点呢??  我改为setOperator_ActionListener监听了   bAdd.addActionListener(new setOperator_ActionListener());
    bDec.addActionListener(new setOperator_ActionListener());
    bMul.addActionListener(new setOperator_ActionListener());
    bDiv.addActionListener(new setOperator_ActionListener());
    bCal.addActionListener(new setOperator_ActionListener());
    但是运行时还是出现错误啊1!!   等于监听失败
      

  3.   

    报错如下:Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
    at java.lang.Double.parseDouble(Unknown Source)
    at jisuanqi.Calculator.stringTodouble(Calculator.java:7)
    at jisuanqi.Calculator.operate(Calculator.java:11)
    at jisuanqi.Calculator.opAdd(Calculator.java:34)
    at jisuanqi.CalaulatorGUI$setOperator_ActionListener.actionPerformed(CalaulatorGUI.java:150)
    at java.awt.Button.processActionEvent(Unknown Source)为什么会这样??
      

  4.   

    at jisuanqi.Calculator.stringTodouble(Calculator.java:7)
    public String opAdd(String x){
    operate(" ");
    op=add;
    return result;
    }private void operate(String x)
    {
    double x1=stringTodouble(x);
    double y=stringTodouble(result)