找传奇、传世资源到传世资源站!
Java 正文

单词打字练习java程序(发音、朗读)

  • 资源分类:Java
  • 发 布 人:房东的猫
  • 文件大小:1656750
  • 文件格式:.rar
  • 浏览次数:30
  • 下载次数: 0
  • 发布时间:9月5日

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

单词练习(带发音)程序,java语音编写,有朗读功能,即可朗读你练习的单词,朗文发音,提高单词发音能力,实例中包含jmf.jar(javax.media jar

from clipboard
from clipboard
from clipboardimport java.awt.*;import java.awt.event.*;import java.io.IOException;import javax.swing.*;@SuppressWarnings("serial")public class FirstWindow extends Frame implements ActionListener{String practiceFileName;JTextField msm;JMenuBar myMenuBar;JMenu myMenu;JMenu info;JMenuItem openItem;JMenuItem openHistoryItem;JMenuItem eixtItem;JMenuItem infoItem;JMenuItem cet4Item;JMenuItem cet6Item;FileDialog fileDialogLoad;//文件对话框FirstWindow()throws IOException {msm = new JTextField(25);myMenuBar = new JMenuBar();myMenu = new JMenu("菜单");info = new JMenu("关于");openItem = new JMenuItem("打开练习文件");openHistoryItem = new JMenuItem("直接进入历史练习点");cet4Item = new JMenuItem("直接进入四级单词练习");cet6Item = new JMenuItem("直接进入六级单词练习");eixtItem = new JMenuItem("退出");infoItem = new JMenuItem("关于");setTitle("Word PV");setBounds(300, 200, 600, 400);addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}});/* 添加菜单条 */add(myMenuBar,BorderLayout.NORTH);myMenuBar.add(myMenu);myMenuBar.add(info);myMenu.add(openItem);myMenu.add(openHistoryItem);myMenu.add(cet4Item);myMenu.add(cet6Item);myMenu.add(eixtItem);info.add(infoItem);openItem.addActionListener(this);openHistoryItem.addActionListener(this);cet4Item.addActionListener(this);cet6Item.addActionListener(this);eixtItem.addActionListener(this);infoItem.addActionListener(this);JPanel messagePanel = new JPanel();add(messagePanel,BorderLayout.CENTER);messagePanel.add(msm);msm.setFont(new Font("", 1, 25));msm.setText("请通过菜单打开TXT练习文件");msm.setVisible(true);fileDialogLoad = new FileDialog(this, "打开练习文件", FileDialog.LOAD);fileDialogLoad.setVisible(false);fileDialogLoad.setDirectory(System.getProperty("user.dir") "\\PracticeText");fileDialogLoad.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {fileDialogLoad.setVisible(false);}});setVisible(true);}public void actionPerformed(ActionEvent e) {if (e.getSource() == openItem) {fileDialogLoad.setVisible(true);practiceFileName = fileDialogLoad.getFile();String filePath = fileDialogLoad.getDirectory();//System.out.println(filePath);//测试代码if (practiceFileName != null && practiceFileName.endsWith(".txt")) {try {@SuppressWarnings("unused")PracticeWindow myWindow = new PracticeWindow(filePath,practiceFileName);this.dispose();} catch (IOException e1) {// TODO Auto-generated catch blocke1.printStackTrace();}} elsemsm.setText("别逗了,要打开一个TXT练习文件");}else if(e.getSource() == openHistoryItem){/*打开历史点*/msm.setText("此功能预留,但在你进入练习窗口时可用");}else if(e.getSource() == eixtItem){System.exit(1);}else if(e.getSource() == infoItem){JOptionPane.showMessageDialog(this," 单词练习小程序\r made in suzhou\r by ming\r 2010.11.16-2010.12.13", "Informatica",JOptionPane.INFORMATION_MESSAGE);}else if(e.getSource() == cet4Item){try {@SuppressWarnings("unused")PracticeWindow cet4Window = new PracticeWindow(System.getProperty("user.dir") "\\PracticeText\\","Cet4Word.txt");this.dispose();} catch (IOException e1) {//e1.printStackTrace();msm.setText("创建四级练习窗口失败!!!");}}else if(e.getSource() == cet6Item){try {@SuppressWarnings("unused")PracticeWindow cet6Window = new PracticeWindow(System.getProperty("user.dir") "\\PracticeText\\","Cet6Word.txt");this.dispose();} catch (IOException e1) {// TODO Auto-generated catch block//e1.printStackTrace();msm.setText("创建六级练习窗口失败!!!");}}}}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复