0414复利计算--结对

这次主要是把之前的代码整理一下做成一个人性化的界面,简单实现用户输入以及输出记录。

当用户输入完数据点击确定的时候数据会清零,同时在旁边显示记录条。但还没能够以数组

或者文件数据库那样记录之前输入过的数据,所以输出的只是当前的记录。

搭档:麦锦俊 149 http://www.cnblogs.com/maijinjun

     

private void jButton0MouseMouseClicked(MouseEvent event) {
        
        String p =this.jTextField0.getText();
        String i =this.jTextField1.getText();
        String year =this.jTextField2.getText();
        String sum =this.jTextField3.getText();
    //    String list[] = null;
        int n=0;
        if(this.jComboBox0.getSelectedItem()=="复利计算"){
            if(this.jTextField0.getText().equals("")||this.jTextField1.getText().equals("")||this.jTextField2.getText().equals(""))
            {
                this.jTextField0.setText("请输入大于0的数");
                this.jTextField1.setText("请输入大于0的数");
                this.jTextField2.setText("请输入大于0的数");
            }
            else{
            
                f.calculate(p, i, year);
                this.jTextField3.setText(f.sum);
                
                jTextArea0.setText("本金	利率	时间	终值
");
                jTextArea0.append(p+"	"+i+"	"+year+"	"+f.sum);
    //            list[n+1]=jTextArea0.getText();
                this.jTextField0.setText(null);
                this.jTextField1.setText(null);
                this.jTextField2.setText(null);
                this.jTextField3.setText(null);
        }
        }
        if(this.jComboBox0.getSelectedItem()=="单利计算"){
            
            if(this.jTextField0.getText().equals("")||this.jTextField1.getText().equals("")||this.jTextField2.getText().equals(""))
            {
                this.jTextField0.setText("请输入大于0的数");
                this.jTextField1.setText("请输入大于0的数");
                this.jTextField2.setText("请输入大于0的数");
            }
            d.calculate(p, i, year);
            this.jTextField3.setText(d.sum);
            jTextArea0.setText("本金	利率	时间	终值
");
            jTextArea0.append(p+"	"+i+"	"+year+"	"+d.sum);
//            list[n+1]=jTextArea0.getText();
            this.jTextField0.setText(null);
            this.jTextField1.setText(null);
            this.jTextField2.setText(null);
            this.jTextField3.setText(null);
        }
        


    }

    private void jButton1MouseMouseClicked(MouseEvent event) {
        this.jTextField0.setText(null);
        this.jTextField1.setText(null);
        this.jTextField2.setText(null);
        this.jTextField3.setText(null);
    }

原文地址:https://www.cnblogs.com/xiaoyy/p/5391844.html