软件工程网络15结对编程作业(201521123111 陈伟泽)

1.成员:

陈伟泽
詹昌锦
码云

2.不会

给个图:

选择博客:http://www.cnblogs.com/shizhuangde/p/6552441.html
代码:https://coding.net/u/lhl1212/p/ArithmeticTest/git?public=true
需求分析:
有了界面
语言选择
四则运算
计时功能
增量计算

改进:
增加个准确率判定会好一点。

原有代码:

语言选择功能:

    public void setLanguage() {
        String[] choiceLanguage = { "简体中文", "繁体中文", "English" };
        String language = (String) JOptionPane.showInputDialog(null, "请选择客户端的语言:\n", "Choice a language for client",
                JOptionPane.PLAIN_MESSAGE, new ImageIcon("icon.png"), choiceLanguage, "简体中文");
        if (language == null) {
            System.exit(-1);
        } else {
            try {
                reader = new BufferedReader(new FileReader(new File("language/" + language + ".txt")));
                String s;
                while ((s = reader.readLine()) != null) {
                    tips.add(s);
                }
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

计时功能

public void showTime() {
        labTime = new JLabel(tips.get(1) + "00:00");
        labTime.setBounds(50, 0, 120, 50);
        jpMain.add(labTime);
        new Thread() {
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(1000);
                        seconds++;
                        if (seconds >= 60) {
                            seconds = 0;
                            minutes++;
                        }
                        if (seconds < 10)
                            secStr = "0" + seconds.toString();
                        else
                            secStr = seconds.toString();
                        if (minutes < 10)
                            minStr = "0" + minutes.toString();
                        else
                            minStr = minutes.toString();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    labTime.setText(tips.get(1) + minStr + ":" + secStr);
                    if(isEnd)
                        break;
                }
            }
        }.start();
    }

boom!

3感受

没什么特别的感受吧,有点后悔读这个专业了。嗯。

posted @ 2018-03-25 20:21  趁年轻拼一拼  阅读(148)  评论(0编辑  收藏  举报