資源簡介
用java編寫"人民幣對港幣,人民幣對美金,港幣對美金,三都的匯率轉換"的源程序代碼

代碼片段和文件信息
package?huilv;
import?javax.swing.*;
import?java.awt.event.*;
import?java.awt.*;
public?class?Jisuan?extends?Jframe
{
??private?JMenuBar?mb;
??private?JMenu?toolhelpexit;
??private?JMenuItem?colorhuihelexi;
??private?JPanel?p1p2;
??private?JLabel?l1l2l3l4;
??private?JComboBox?c1c2;
??private?JTextField?txt1txt2;
??private?JButton?b1b2;
??private?String?str1[]={“人民幣““港幣““美金“};
??private?String?s1=“人民幣“s2=“人民幣“?money;
??private?int?i;
??public?Jisuan()
??{
??super(“匯率計算器“);
??Container?c=getContentPane();
??this.setResizable(false);
??mb=new?JMenuBar();
??tool=new?JMenu(“工具“);
??help=new?JMenu(“幫助“);
??exit=new?JMenu(“退出“);
??color=new?JMenuItem(“設置背景顏色“);
??hui=new?JMenuItem(“匯率“);
??hel=new?JMenuItem(“幫助“);
??exi=new?JMenuItem(“退出“);
??mb.add(tool);
??mb.add(help);
??mb.add(exit);
??tool.add(color);
??tool.add(hui);
??help.add(hel);
??exit.add(exi);
??setJMenuBar(mb);
??p1=new?JPanel();
??p2=new?JPanel();
??l1=new?JLabel(“????????????幣??種??1?:?????????“);
??l2=new?JLabel(“????????????幣??種??2?:???????????“);
??l3=new?JLabel(“?輸入兌換的貨幣量?:“);
??l4=new?JLabel(“????兌?換?結?果???:???“);
??c1=new?JComboBox(str1);
??c1.setMaximumRowCount(3);
??c2=new?JComboBox(str1);
??c2.setMaximumRowCount(3);
??b1=new?JButton(“???兌???換???“);
??b2=new?JButton(“重新計算“);
??txt1=new?JTextField(10);
??txt2=new?JTextField(20);
??p1.add(l1);
??p1.add(c1);
??p1.add(l2);
??p1.add(c2);
??p1.add(l3);
??p1.add(txt1);
??p1.add(l4);
??p1.add(txt2);
??p1.add(b1);
??p1.add(b2);
??p1.setBounds(4050300200);
??p1.setVisible(false);
??p2.setVisible(true);
??c.add(p1);
??c.add(p2BorderLayout.CENTER);
??setVisible(true);
??setSize(400400);
??color.addActionListener(new?Handler1());
??hel.addActionListener(new?Handler1());
??exi.addActionListener(new?Handler1());
??hui.addActionListener(new?Handler2());
??c1.addItemListener(new?Handler3());
??c2.addItemListener(new?Handler3());
??b1.addActionListener(new?Handler4());
??b2.addActionListener(new?Handler4());
??}
??class?Handler1?implements?ActionListener
??{
??public?void?actionPerformed(ActionEvent?e)
??{
??if(e.getSource()==color)
??{
?p2.setBackground(Color.BLUE);
?p1.setBackground(Color.orange);
??}
??if(e.getSource()==hel)
??{
??JOptionPane?a=new?JOptionPane();
??a.showMessageDialog(null“百度一下就知道了“);
??}
??if(e.getSource()==exi)
??{
??System.exit(0);
??}
??}
??}
??class?Handler2?implements?ActionListener
??{
??public?void?actionPerformed(ActionEvent?e)
??{
??if(e.getSource()==hui)
??p1.setVisible(true);
??}
??}
??class?Handler3?implements?ItemListener
??{
??public?void?itemStateChanged(ItemEvent?e)
??{
??if(e.getSource()==c1)
??{
??s1=str1[c1.getSelectedIndex()];
??
??}
??if(e.getSource()==c2)
??{
??s2=str1[c2.getSelectedIndex()];
??}
??}
??}
??class?Handler4?implements?Action
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????388??2009-12-29?13:10??匯率計算\.project
?????文件???????2882??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan$Handler4.class
?????文件???????5597??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan.class
?????文件???????1374??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan$Handler1.class
?????文件????????905??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan$Handler2.class
?????文件???????1069??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan$Handler3.class
?????文件????????551??2009-12-30?09:33??匯率計算\bin\huilv\Jisuan$Handler5.class
?????文件???????5080??2009-12-30?09:33??匯率計算\src\huilv\Jisuan.java
?????文件????????232??2009-12-29?13:10??匯率計算\.classpath
?????目錄??????????0??2009-12-29?23:53??匯率計算\bin\huilv
?????目錄??????????0??2009-12-29?13:11??匯率計算\src\huilv
?????目錄??????????0??2009-12-29?13:10??匯率計算\bin
?????目錄??????????0??2009-12-29?13:10??匯率計算\src
?????目錄??????????0??2009-12-29?13:02??匯率計算
-----------?---------??----------?-----??----
????????????????18078????????????????????14
- 上一篇:JAVA調用U盾 UKEY網上交易安全認證
- 下一篇:水果忍者java版
評論
共有 條評論