欢迎来到天天文库
浏览记录
ID:34633582
大小:74.23 KB
页数:8页
时间:2019-03-08
《java计算器代码及编程思想new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、䅵ㅫ఼ⱘՓ⫼䇈ᯢঞ㓪ᗱᛇϔˈ㓪䆥⑤ҷⷕˈᠻ㸠ϟ䗄᪡˖1ˈᠻ㸠䇁হjavacjisuan.java⫳៤jisuan.class2ˈ⫼AppletViewerᶹⳟ䅵ㅫ఼˄Applet˅ᠻ㸠䇁হappletviewerjisuan.html3ˈᠻ㸠䅵ㅫ఼Ⳍ݇᪡݊Ёˈ᭄ᄫ䬂0—9ᦤկ᭄ᄫ䕧ܹˈBackЎࠡ䗔ϔԡCEЎপ⍜にষݙ᭄ᄫ䕧ܹCЎ⏙䳊+خࡴ⊩䖤ㅫ—خޣ⊩䖤ㅫ*خЬ⊩䖤ㅫ/خ䰸⊩䖤ㅫ%خ∖ⱒߚ↨䖤ㅫMSᄬټⳂࠡሣᐩᰒ⼎᭄ᄫMRপߎᄬټЁ᭄ᄫMC⏙䰸ᄬټM+ᇚᔧࠡ䕧᭄ܹᄫϢᄬټЁ᭄ᄫⳌࡴৢᄬټ
2、DŽབᵰ≵᳝䕧ܹⳈᣝϟ䆹䬂ˈ߭ᇚᄬټⱘ᭄ᄫЬ2ৢᄬټ䆒䅵ᗱᛇ˖ܜᅲ⦄䅵ㅫ఼ⱘ⬠䴶ˈ⬠䴶⏏ࡴ᳔ᴀᰒ⼎ࡳ㛑ˈेᰒ⼎ऎϞᰒ⼎⫼᠋᠔⚍ߏⱘⳌᑨ䬂ؐDŽᅲ⦄џӊ໘⧚ˈᇍ⫼᠋᠔䕧ܹ䬂ؐ䖯㸠߸ᮁˈᠻ㸠Ⳍᑨ᪡DŽᅠ᪡ˈᬍBUGDŽ⑤ᑣ˖//jisuan:Calculatorimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.util.*;publicclassjisuanextendsJAppletimplement
3、sActionListener{privateJTextFieldjtf=newJTextField(10);privatebooleannewNumber=true;privateintresult=0;privateStringop="=";Stackcunchu;publicvoidinit(){//Ꮧሔㅵ⧚ˈ䆒ᅮᣝ䪂JButtonbt;JPanelp=newJPanel();p.setLayout(newBorderLayout());cunchu=newStack();JPanelwes
4、tPanel=newJPanel();westPanel.setLayout(newGridLayout(5,0));westPanel.add(newJButton(""));westPanel.add(bt=newJButton("MC"));bt.addActionListener(this);westPanel.add(bt=newJButton("MR"));bt.addActionListener(this);westPanel.add(bt=newJButton("MS"));bt.
5、addActionListener(this);westPanel.add(bt=newJButton("M+"));bt.addActionListener(this);PanelcenterPanel=newPanel();centerPanel.setLayout(newBorderLayout());Panelp1=newPanel();Panelp2=newPanel();//䆒ᅮᣝ䪂ˈ໘⧚џӊp1.setLayout(newFlowLayout(FlowLayout.RIGHT));p
6、1.add(bt=newJButton("Back"));bt.addActionListener(this);p1.add(bt=newJButton("CE"));bt.addActionListener(this);p1.add(bt=newJButton("C"));bt.addActionListener(this);p2.setLayout(newGridLayout(4,5));p2.add(bt=newJButton("7"));bt.addActionListener(this)
7、;p2.add(bt=newJButton("8"));bt.addActionListener(this);p2.add(bt=newJButton("9"));bt.addActionListener(this);p2.add(bt=newJButton("/"));bt.addActionListener(this);p2.add(bt=newJButton("4"));bt.addActionListener(this);p2.add(bt=newJButton("5"));bt.addA
8、ctionListener(this);p2.add(bt=newJButton("6"));bt.addActionListener(this);p2.add(bt=newJButton("*"));bt.addActionListener(this);p2.add(bt=newJButton("1"));bt.addActionListener(this);p2.add(bt=newJButton("2"));bt.addActionListener(this);p2.add(
此文档下载收益归作者所有