一、需求分析

复利计算再升级------------------------------------------------------------

客户在大家的引导下,有了更多的想法:

  1. 这个数据我经常会填.....帮我预先填上呗?......
  2. 把界面做得简单漂亮好操作一点呗?
  3. 能不能帮我转成个APP,我装到手机上就更方便了?
  4. 我觉得这个很有用,很多人可能都需要这些功能,做到我的微信公众号上吧?
  5. 能不能不要让我填表单,让我发条消息,或者对着手机说句话就可以了

二、项目简介

使用软件:myeclipse,dreamweaver 8

结对成员:杨晓霞、周诗琦

主要用途:复利计算,单利计算,定额投资 ,等额投资,组合投资

三、成果

 

四、主要代码

 

  1 public class fuli1  extends JFrame
  2 {
  3     private JLabel a1;
  4     private JLabel a2;
  5     private JLabel a3;
  6     private JLabel a4;
  7     private JLabel a5;
  8     private JTextField b1;
  9     private JTextField b2;
 10     private JTextField b3;
 11     private JTextField b4;
 12     private JTextField b5;
 13     private JButton c1;
 14     private JButton c2;
 15     private JButton c3;
 16     private JButton c4;
 17     private JButton c5;
 18     private JButton c6;
 19     private JButton c7;
 20     private JButton c8;
 21     private JTextArea text;
 22     public fuli1()
 23     {
 24         creatComponents()    ;
 25         layoutComponents();
 26         registerHandlers();
 27         setTitle("存款应用程序");
 28         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 29         pack();
 30     }
 31     private void  creatComponents()    
 32     {
 33         a1=new JLabel("本  金 ");
 34         a1.setFont(new Font("宋体",Font.BOLD,18));
 35         a2=new JLabel("年利率 ");
 36         a2.setFont(new Font("宋体",Font.BOLD,18));
 37         a3=new JLabel("年 数 ");
 38         a3.setFont(new Font("宋体",Font.BOLD,18));
 39         a4=new JLabel("本息 ");
 40         a4.setFont(new Font("宋体",Font.BOLD,18));
 41         a5=new JLabel("月利率 ");
 42         a5.setFont(new Font("宋体",Font.BOLD,18));
 43         
 44         
 45         
 46         b1=new JTextField(10);//本金
 47         b2=new JTextField(10);//利率
 48         b3=new JTextField(10);//年数
 49         b4=new JTextField(10);//本息
 50         b5=new JTextField(10);//月利率
 51         c1=new JButton("复利");
 52         c1.setFont(new Font("宋体",Font.BOLD,15));
 53         c3=new JButton("单利");
 54         c3.setFont(new Font("宋体",Font.BOLD,15));
 55         c4=new JButton("定投");
 56         c4.setFont(new Font("宋体",Font.BOLD,15));
 57         c2=new JButton("清除");
 58         c2.setFont(new Font("宋体",Font.BOLD,15));
 59         c5=new JButton("复利存期/利率");
 60         c5.setFont(new Font("宋体",Font.BOLD,15));
 61         c6=new JButton("等额还款");
 62         c6.setFont(new Font("宋体",Font.BOLD,15));
 63         c7=new JButton("分类还款");
 64         c7.setFont(new Font("宋体",Font.BOLD,15));
 65         c8=new JButton("组合投资");
 66         c8.setFont(new Font("宋体",Font.BOLD,15));
 67         text=new JTextArea();
 68     }
 69     private void layoutComponents()
 70     {
 71         //Container c=this.getContentPane();    
 72         setLayout(new FlowLayout());
 73         JPanel panel1=new JPanel();
 74         panel1.add(a1);
 75         panel1.add(b1);
 76         
 77         JPanel panel2=new JPanel();
 78         panel2.add(a2);
 79         panel2.add(b2);
 80         panel2.add(a5);
 81         panel2.add(b5);
 82         
 83         JPanel panel3=new JPanel();
 84         panel3.add(a3);
 85         panel3.add(b3);
 86         JPanel panel4=new JPanel();
 87         panel4.add(a4);
 88         panel4.add(b4);
 89         
 90         JPanel panel5=new JPanel();
 91         panel5.add(c1);
 92         panel5.add(c3);
 93         panel5.add(c4);
 94         panel5.add(c5);
 95         panel5.add(c2);
 96         panel5.add(c6);
 97         panel5.add(c8);
 98         JPanel  leftpanel=new JPanel(new GridLayout(6,2));
 99         leftpanel.add(panel1);
100         leftpanel.add(panel2);
101         leftpanel.add(panel3);
102         leftpanel.add(panel4);
103         leftpanel.add(panel5);
104         JScrollPane panel6=new JScrollPane(text);
105         panel6.setPreferredSize(new Dimension(250,100));
106         add(leftpanel);
107         add(panel6);
108     }
109     private  void registerHandlers()
110     {
111          c1ActionEventHander hander1=new  c1ActionEventHander();
112          c1.addActionListener(hander1);
113          c2ActionEventHander hander2=new  c2ActionEventHander();
114          c2.addActionListener(hander2);
115     c3ActionEventHander hander3=new  c3ActionEventHander();
116         c3.addActionListener(hander3);
117         c4ActionEventHander hander4=new  c4ActionEventHander();
118         c4.addActionListener(hander4);
119         c5ActionEventHander hander5=new  c5ActionEventHander();
120         c5.addActionListener(hander5);
121         c6ActionEventHander hander6=new  c6ActionEventHander();
122         c6.addActionListener(hander6);
123         c7ActionEventHander hander7=new  c7ActionEventHander();
124         c7.addActionListener(hander7);
125     }

 

 

 

 

 

五、感想

第一次综合使用web版本,有点粗糙,但同样也加深了我们的理解

posted on 2016-04-14 22:54  nicole01  阅读(473)  评论(6编辑  收藏  举报