给个图:
选择博客:http://www.cnblogs.com/shizhuangde/p/6552441.html
代码:https://coding.net/u/lhl1212/p/ArithmeticTest/git?public=true
需求分析:
有了界面
语言选择
四则运算
计时功能
增量计算git
改进:
增长个准确率断定会好一点。.net
原有代码:code
语言选择功能:htm
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(); } } }
计时功能blog
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!ip
没什么特别的感觉吧,有点后悔读这个专业了。嗯。get