欢迎来到天天文库
浏览记录
ID:56794198
大小:608.50 KB
页数:20页
时间:2020-07-12
《Java GUI多国语言动态切换.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、上来就给源码,这就是我做事风格packagelangue;/***authorHDSSHTLL*/importjavax.swing.JRadioButtonMenuItem;importjavax.swing.SwingUtilities;publicclassNewJFrameextendsjavax.swing.JFrame{privatestaticjava.util.ResourceBundleresources=java.util.ResourceBundle.getBundle("langue/softw
2、areResources");publicNewJFrame(){initComponents();}privatevoidinitComponents(){jLabel1=newjavax.swing.JLabel();jTextField1=newjavax.swing.JTextField();jLabel2=newjavax.swing.JLabel();jTextField2=newjavax.swing.JTextField();jButton1=newjavax.swing.JButton();jButt
3、on2=newjavax.swing.JButton();jMenuBar1=newjavax.swing.JMenuBar();jMenu1=newjavax.swing.JMenu();jRadioButtonMenuItem1=newJRadioButtonMenuItem();jRadioButtonMenuItem2=newJRadioButtonMenuItem();jRadioButtonMenuItem3=newJRadioButtonMenuItem();jRadioButtonMenuItem4=n
4、ewJRadioButtonMenuItem();jRadioButtonMenuItem5=newJRadioButtonMenuItem();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jMenu1.setText("File");//英语jRadioButtonMenuItem1.setText("English");jRadioButtonMenuItem1.addActionListener(newjava.awt.e
5、vent.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jRadioButtonMenuItem2.setSelected(false);jRadioButtonMenuItem3.setSelected(false);jRadioButtonMenuItem4.setSelected(false);jRadioButtonMenuItem5.setSelected(false);resources=java.util
6、.ResourceBundle.getBundle("langue/softwareResources",java.util.Locale.ENGLISH);updateLabel();}});jMenu1.add(jRadioButtonMenuItem1);//法语jRadioButtonMenuItem3.setText("france");jRadioButtonMenuItem3.addActionListener(newjava.awt.event.ActionListener(){publicvoidac
7、tionPerformed(java.awt.event.ActionEventevt){jRadioButtonMenuItem2.setSelected(false);jRadioButtonMenuItem1.setSelected(false);jRadioButtonMenuItem4.setSelected(false);jRadioButtonMenuItem5.setSelected(false);resources=java.util.ResourceBundle.getBundle("langue/
8、softwareResources",java.util.Locale.FRANCE);updateLabel();}});jMenu1.add(jRadioButtonMenuItem3);//语jRadioButtonMenuItem4.setText("KOREA");jRadioButtonMenuItem4.addAct
此文档下载收益归作者所有