基本信息
源码名称:单词打字练习java程序(发音、朗读)
源码大小:1.58M
文件格式:.rar
开发语言:Java
更新时间:2019-06-30
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
单词练习(带发音)程序,java语音编写,有朗读功能,即可朗读你练习的单词,朗文发音,提高单词发音能力,
实例中包含jmf.jar(javax.media jar)
import 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 block
e1.printStackTrace();
}
} else
msm.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("创建六级练习窗口失败!!!");
}
}
}
}