结对编程
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();
}
3.码云##
4.感受##
我真的不会打代码啊!编程语言都挂了重修了真的不会啊,真的是一种折磨!从0基础开始学也跟不上,以后也肯定不会从事这编程的方向。菩萨保佑!