• 复利计算器--结对2.0


    结对项目:复利计算

    搭档:30蔡京航  http://www.cnblogs.com/cjh123/

     github:https://github.com/alfredzhu/teamwork

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

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

    我们组选择1和2两个方向加以改进

    预计用时 3H

    实际用时 2.5H

    新增参数

     1 String x = ""; 2 String y = ""; 3 String z = "";  

    预填功能

     1 private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
     2         // 预填数据
     3         Object[] obj2 = { "本金", "利率", "年限" };
     4         String s = (String) JOptionPane.showInputDialog(null, "请选择你需要预填的数据:
    ",
     5                 "预填", JOptionPane.PLAIN_MESSAGE, new ImageIcon("icon.png"),
     6                 obj2, "利率");
     7         if (s == "本金") {
     8             if (action == 0 || action == 1 || action == 2 || action == 4
     9                     || action == 5 || action == 6 || action == 7 || action == 8) {
    10                 x = (String) JOptionPane.showInputDialog(null, "请输入预填的本金:
    ",
    11                         "预填值", JOptionPane.PLAIN_MESSAGE, null, null, "在这输入");
    12                 jTextField1.setText("" + x);
    13             }
    14         }
    15         if (s == "利率") {
    16             if (action == 0 || action == 1 || action == 2 || action == 3
    17                     || action == 4 || action == 6 || action == 7 || action == 8) {
    18                 y = (String) JOptionPane.showInputDialog(null, "请输入预填的利率:
    ",
    19                         "预填值", JOptionPane.PLAIN_MESSAGE, null, null, "在这输入");
    20                 jTextField2.setText("" + y);
    21             }
    22         }
    23         if (s == "年限") {
    24             if (action == 0 || action == 1 || action == 2 || action == 3
    25                     || action == 4 || action == 6 || action == 7 || action == 8) {
    26                 z = (String) JOptionPane.showInputDialog(null, "请输入预填的年限:
    ",
    27                         "预填值", JOptionPane.PLAIN_MESSAGE, null, null, "在这输入");
    28                 jTextField3.setText("" + z);
    29             }
    30             if (action == 5) {
    31                 z = (String) JOptionPane.showInputDialog(null, "请输入预填的年限:
    ",
    32                         "预填值", JOptionPane.PLAIN_MESSAGE, null, null, "在这输入");
    33                 jTextField2.setText("" + z);
    34             }
    35         }
    36     }

    添加背景

     1     //将背景图绘在JFrame的倒数第二底层的Layeredpane上
     2           JLabel   picLabel   =   new   JLabel(); 
     3           picLabel.setIcon(new   ImageIcon( "under.jpg")); 
     4           this.getLayeredPane().add(picLabel, new Integer(Integer.MIN_VALUE));
     5           picLabel.setBounds(0,0,1000,705);
     6          
     7         //再在JFrame的最上层contentpane上添加按钮并且设置contentpane为透明。
     8           JPanel content = new JPanel();
     9           content=(JPanel)getContentPane();  
    10           content.setOpaque(false);
    11         //  content.add(monthOrWeekPlanBtn);

    运行效果

    结果可以在各个功能下实现预填功能

    总结:在写代码中虽然会遇到困难,但是还是要多多去思考才能解决问题的跟本,小伙伴能及时与我分享他的想法,我很欣慰,所以也完成的挺快的,能提高不少效率,再加上分工,因此效率提升的不止一倍呢。

    再者,对于客户的需求,也是方便我们自身的另一种方式,另我们的程序更加完美,就如预填功能一样,在我们知道了确切的利率时,我们经常要填,所以预填后,客户能偷点懒,自己也能偷点懒,何乐而不为呢。

  • 相关阅读:
    Java Number类
    Java StringBuffer和StringBuilder类
    Java String类
    Java 日期时间
    Java 数组
    Java 方法
    Java正则表达式
    一步步学习SPD2010--第五章节--处理数据视图(6)--使用XSLT
    一步步学习SPD2010--第五章节--处理数据视图(5)--显示和隐藏内容
    一步步学习SPD2010--第五章节--处理数据视图(4)--应用条件格式
  • 原文地址:https://www.cnblogs.com/alfredzhu/p/5392922.html
Copyright © 2020-2023  润新知