欢迎来到天天文库
浏览记录
ID:38581619
大小:664.00 KB
页数:21页
时间:2019-06-15
《Java GUI多国语言动态切换》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、上来就给源码,这就是我做事风格packagelangue;/***@authorHDSSHTLL*/importjavax.swing.JRadioButtonMenuItem;importjavax.swing.SwingUtilities;publicclassNewJFrameextendsjavax.swing.JFrame{privatestaticjava.util.ResourceBundleresources=java.util.ResourceBundle.getBundle("langue/softwareResources");publicNewJFr
2、ame(){initComponents();}privatevoidinitComponents(){jLabel1=newjavax.swing.JLabel();jTextField1=newjavax.swing.JTextField();jLabel2=newjavax.swing.JLabel();jTextField2=newjavax.swing.JTextField();jButton1=newjavax.swing.JButton();jButton2=newjavax.swing.JButton();jMenuBar1=newjavax.swing.J
3、MenuBar();jMenu1=newjavax.swing.JMenu();jRadioButtonMenuItem1=newJRadioButtonMenuItem();jRadioButtonMenuItem2=newJRadioButtonMenuItem();jRadioButtonMenuItem3=newJRadioButtonMenuItem();jRadioButtonMenuItem4=newJRadioButtonMenuItem();jRadioButtonMenuItem5=newJRadioButtonMenuItem();setDefault
4、CloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jMenu1.setText("File");//英语jRadioButtonMenuItem1.setText("English");jRadioButtonMenuItem1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jRadioButtonMenuItem2.setSelecte
5、d(false);jRadioButtonMenuItem3.setSelected(false);jRadioButtonMenuItem4.setSelected(false);jRadioButtonMenuItem5.setSelected(false);resources=java.util.ResourceBundle.getBundle("langue/softwareResources",java.util.Locale.ENGLISH);updateLabel();}});jMenu1.add(jRadioButtonMenuItem1);//法语jRad
6、ioButtonMenuItem3.setText("france");jRadioButtonMenuItem3.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jRadioButtonMenuItem2.setSelected(false);jRadioButtonMenuItem1.setSelected(false);jRadioButtonMenuItem4.setSelected(false)
7、;jRadioButtonMenuItem5.setSelected(false);resources=java.util.ResourceBundle.getBundle("langue/softwareResources",java.util.Locale.FRANCE);updateLabel();}});jMenu1.add(jRadioButtonMenuItem3);//韩语jRadioButtonMenuItem4.setText("KOREA");jRadioButtonMenuItem4.addA
此文档下载收益归作者所有