freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java課程設(shè)計(jì)---科學(xué)計(jì)算器-java-全文預(yù)覽

  

【正文】 )。 ()。//選項(xiàng)組 (editItem1)。 help2 = new JMenuItem(關(guān)于計(jì)算器 (A))。 (new Font(宋體 ,12))。 (seeItem2)。 (this)。 (new Font(宋體 ,12))。 (new Font(宋體 , , 12))。 menu2 = new JMenu(查看 (V))。 panel3 = new JPanel(new GridLayout(5, 1, 5, 5))。//設(shè)置標(biāo)題欄 df = new DecimalFormat(.)。 private double result = 0。 private ButtonGroup bgb。 濟(jì)南大學(xué)課程設(shè)計(jì) 14 private JMenuItem editItem1, editItem2, help1, help2, help3。 public class CalculatorSimple extends JFrame implements ActionListener { private JTextField tf。 import 。 import 。 import 。 import 。 } 濟(jì)南大學(xué)課程設(shè)計(jì) 13 } } /** * main方法 */ public static void main(String[] args) { new Calculator().setVisible(true)。 IfResult = true。 } if(str==π) { (())。 IfResult = true。 } }else{ if(().length() 2){ (().substring(0, ().length() 1))。 ((i))。 if(str == C){ (0)。 }else{ getResult((()))。 } /* ′″角度轉(zhuǎn)換 */ /** * 將角度值轉(zhuǎn)換成弧度值,方便三角函數(shù)的計(jì)算 */ else if((′″)){ double i = (())。 } } /* x^2求平方 */ else if((x^2)){ double i = (())。k=j。 } 濟(jì)南大學(xué)課程設(shè)計(jì) 10 /* n!求階乘 */ else if((n!)){ double i = (())。 } /* cos求余弦函數(shù) */ else if((cos)){ double i = (())。 } /* 1/x求倒數(shù) */ else if((1/x)){ if((()) == 0){ (除數(shù)不能為零 )。 } } 濟(jì)南大學(xué)課程設(shè)計(jì) 9 /* log求常用對(duì)數(shù) */ else if((log)){ double i = (())。 } /** * 運(yùn)算符號(hào)的事件監(jiān)聽(tīng) */ class Signs implements ActionListener{ public void actionPerformed(ActionEvent e) { /* * 用 ActionEvent對(duì)象的 getActionCommand()方法 * 取得與引發(fā)事件對(duì)象相關(guān)的字符串 */ String str = ()。194。} else if(oper == 161。 161。//在面板上增加按鈕 (color)。//窗口不可改變大小 (500, 200)。 (panel3, )。 addButton(panel3, M+, null, )。 (btns)。 JButton btns = new JButton(計(jì)算器 )。 addButton(panel2, π, numActionListener, )。 addButton(panel2, ., new Dot(), )。 addButton(panel2, cos, new Signs(), )。 addButton(panel2, 1, numActionListener, )。193。 addButton(panel2, 4, numActionListener, )。194。 addButton(panel2, 7, numActionListener, )。 addButton(panel1, CE, new Clear(), )。//文字右對(duì)齊 (0)。//實(shí)現(xiàn)數(shù)字監(jiān)聽(tīng) 濟(jì)南大學(xué)課程設(shè)計(jì) 6 /** * 文本域,即為計(jì)算器的屏幕顯示區(qū)域 */ tf = new JTextField()。 (menu2)。 (help1)。 (seeItem1)。 (new Font(宋體 ,12))。 (new Font(宋體 ,12))。 new CalculatorSimple().setVisible(true)。 (true)。 seeItem1 = new JRadioButtonMenuItem(科學(xué)型 )。 editItem2 = new JMenuItem(粘貼 (P) Ctrl+V)。 (new Font(宋體 , , 12))。 /* * 菜單欄 */ myBar = new JMenuBar()。 panel1 = new JPanel(new GridLayout(1, 3, 10, 10))。//設(shè)置數(shù)字監(jiān)聽(tīng) private DecimalFormat df。//字符串返回 private boolean IfResult = true, flag = false。//單選框 private JCheckBoxMenuItem seeItem3。//創(chuàng)建面板容器 private JMenuBar myBar。 import 。 用 setVisible語(yǔ)句對(duì)標(biāo)準(zhǔn)型界面設(shè)置隱藏,默認(rèn)顯示科學(xué)型界面 。 private void addButton(JPanel panel, String name, ActionListener action 語(yǔ)句實(shí)現(xiàn)了 ActionListener 接口,因此可以調(diào)用addActionListener(this)方法對(duì)按鈕進(jìn)行點(diǎn)擊監(jiān)聽(tīng) , 在下面的 public void actionPerformed(ActionEvent e) 方法里面對(duì)各個(gè)點(diǎn)擊事件進(jìn)行處理 。 四、 算法的流程圖 濟(jì)南大學(xué)課程設(shè)計(jì) 2 五、 詳細(xì)設(shè)計(jì)過(guò)程與分析 界面設(shè)計(jì) 設(shè)置內(nèi)容網(wǎng)格布局 BorderLayout,創(chuàng)建菜單欄和文本區(qū),創(chuàng)建單選按鈕,默認(rèn)選中,添加按鈕并加入按鈕,統(tǒng)一設(shè)置按鈕的使用方式。 java 類中的 Math 函數(shù)庫(kù)以及各種串的操作,像是 計(jì)算器的基礎(chǔ)操作( + 247。 文本域,即為計(jì)算器 的屏幕顯示區(qū)域。 三、 設(shè)計(jì)思路 對(duì) Application 運(yùn)用繼承 JFrame 設(shè)計(jì),類的設(shè)計(jì)構(gòu)造方法利用等 。 給各個(gè)按鈕進(jìn)行算法,利用鼠標(biāo)點(diǎn)擊事件,當(dāng)鼠標(biāo)點(diǎn)擊某個(gè)按鈕時(shí)就開(kāi)始執(zhí)行那個(gè)按鈕所定義的算法,生成數(shù)據(jù)并顯示。 器。 添加動(dòng)作監(jiān)聽(tīng)事件:添加數(shù)字監(jiān)聽(tīng),運(yùn)算符號(hào)事件的監(jiān)聽(tīng),清除按鈕的事件監(jiān)聽(tīng),小數(shù)點(diǎn)的事件監(jiān)聽(tīng) 。 new CalculatorSimple().setVisible(true)。 import .*。//創(chuàng)建文本框 private JPanel panel1, panel2, panel3, panel4。 private JRadioButtonMenuItem seeItem1, seeItem2。 private String back。 private Num numActionListener。//保留四位小數(shù) (new BorderLayout(10, 5))。 panel4 = new JPanel(new BorderLayout(5, 5))。 menu3 = new JMenu(幫助 (H))。 /* * 編輯欄 */ editItem1 = new JMenuItem(復(fù)制 (C) Ctrl+C)。 /* * 查看欄 */
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1