給個圖:
選擇博客: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