341. */
342. public class KeyboardListener implements KeyListener{
343.
344. public void keyPressed(KeyEvent e) { 345. }
346.
347. public void keyReleased(KeyEvent e) { 348. }
349.
350. public void keyTyped(KeyEvent e) { 351. char ch = e.getKeyChar();
352. if(ch>='0'&&ch<='9'||ch=='/'){ 353. pressButton(String.valueOf(ch));
354. }
355. if(ch=='='){
356. pressEqualButton(); 357. }
358. if(ch=='+'||ch=='-'){
359. pressOPButton(String.valueOf(ch));
360. }
361. }
362.
363. }
364.
365.
366. /**
367. * 入口方法
368. * @param args
369. */
370. public static void main(String[] args) { 371. new DateCalculator();
372. }
373.
374. }
七、 调试与运行情况