数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx

上传人:b****8 文档编号:21905590 上传时间:2023-02-01 格式:DOCX 页数:42 大小:434.51KB
下载 相关 举报
数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx_第1页
第1页 / 共42页
数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx_第2页
第2页 / 共42页
数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx_第3页
第3页 / 共42页
数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx_第4页
第4页 / 共42页
数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx_第5页
第5页 / 共42页
点击查看更多>>
下载资源
资源描述

数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx

《数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx(42页珍藏版)》请在冰豆网上搜索。

数据结构课程设计报告简易英汉词典系统Word格式文档下载.docx

Connectionconnection=null;

Statementstatement=null;

ResultSetResult=null;

声明全局变量:

StringnewWord,pronunciations,indexWord="

"

deleteWord,searchEnglish,searchChinese,isSound;

它们分别是:

新增单词、新单词音标、引擎词、删除词、查找的英文、查找的汉语、判断音频是否存在。

2、实验功能所定义的各种按钮、文本框、选择框和列表框:

取消删除功能按钮:

JButtondeleteCancelButton=newJButton();

英汉互译面板上的发音按钮:

JButtonsound=newJButton();

浏览词库面板上的发音按钮:

JButtonscanSoundButton=newJButton();

添加单词的按钮:

JButtonaddOkJButton=newJButton();

取消添加功能的按钮:

JButtonaddCancelButton=newJButton();

删除词库单词信息按钮:

JButtondeleteOkButton=newJButton();

浏览词库按钮:

JButtonscanButton=newJButton();

要查找的英文或汉语的文本框输入框:

JTextFieldinputSearchWord=newJTextField();

新增单词文本输入框:

JTextFieldinputNewWord=newJTextField();

新增单词音标输入框:

JTextFieldpronunciation=newJTextField();

新增单词释义输入框:

JTextFieldnewWordChinese=newJTextField();

新增单词过去式输入框:

JTextFieldnewWordPreterite=newJTextField();

新增单词现在进行时态输入框:

JTextFieldnewWordModernism=newJTextField();

要删除的单词输入框:

JTextFieldinputDeleteWord=newJTextField();

新增单词词性复选框:

JComboBoxnewWordClass=newJComboBox();

列出要查找的词的记录信息的多行文本框:

TextAreaoutputSearchEnglish=newTextArea();

列出要删除的单词的记录信息的多行文本框:

TextAreadeleteWordChinese=newTextArea();

列出浏览时需浏览单词信息的多行文本框:

TextAreascanOutput=newTextArea();

DefaultListModelmodel=newDefaultListModel();

列出所查找的英文或汉语对应的单词的列表框:

JListlistSearchEnglish=newJList(model);

列出备选英标的列表框:

JListpronunciationJList=newJList(listItem);

列出可能且可以被删除的单词的列表框:

JListdeleteJList=newJList(model);

列出词库所有单词的列表框:

JListscanWordJList=newJList(model);

3、实现功能所定义的各种函数:

1)publicstaticStringReturn(Stringstr)

将数据库里的单词的音标进行还原。

因为有些音标不能正确存入数据库,只能以其它字符代替,读取时再还原。

2)publicvoidPlay(Stringword)

播放单词word的音频。

3)publicvoidinputSearch_caretUpdate(CaretEvente)

当inputSearch(注:

要查找的词)输入框值改变时,listSearchEnglish(注:

列出查找结果)列表框和outputSearchEnglish(注:

写出单词信息)文本输出框被清空,取inputSearch输入框值赋给indexWord,如果indexWord不为空,连接数据库;

再判断要查找的是英语,还是汉语,根据判断结果进行查找,并将结果集按升序排列,输出到listSearchEnglish列表框

4)publicvoidlistSearchEnglish_mouseClicked(MouseEventme)

当鼠标单击listSearchEnglish列表框时,取所选选项的值赋给变量searchEnglish,去掉其两端空格,outputSearchEnglish文本输出框被清空,发音按钮变成灰白色,从数据库读取要查找的单词,将其音标进行还原,将单词信息输出到outputSearchEnglish文本框,如果可以发音,发音按钮变红色,否则indexWord被赋给空值

5)publicvoidsound_actionPerformed(ActionEvente)

如果查找单词有音频且查找词不为空,则可发音,否则按钮变为灰白色

6)publicvoidinputNewWord_caretUpdate(CaretEvente)

一旦输入的新单词字母不是小写字母或空格时,弹出提示框

7)publicvoidpronunciation_caretUpdate(CaretEvente)

对输入的音标进行处理,因为字符\u0254、\u01DD、‘、\u00E6存入数据库时会变成?

或出错,所以用0、1、2、4分别代替他们,读取时通过调用Return函数还原,且将音标两端和中间空格去掉

8)publicvoidpronunciationJList_mouseClicked(MouseEventme)

当在音标选项列表单击鼠标选择音标时,将所选音标输入音标输入框

9)publicvoidaddOkJButton_actionPerformed(ActionEvente)

读取未读取的输入框的字符,去掉单词、注释各自两端空格,并将去掉它们各自中间两个或两个以上的空格留一个空格,接着在数据库查找添加的单词是否已存在,若已存在,弹出提示框,不能再添加,否则向数据库添加新单词信息,最后清空所有输入框

10)publicvoidaddCancelButton_actionPerformed(ActionEvente)

点击添加取消按钮,新增面板所有输入框被清空

11)publicvoidinputDeleteWord_caretUpdate(CaretEvente)

当inputDeleteWord输入框值改变时,清空deleteJList列表框,读取inputDeleteWord输入框值赋给变量deleteWord,按模糊查找法查找以deleteWord的值开头的所有单词,按升序排列,并将他们输出到deleteJList列表框

12)publicvoiddeleteJList_mouseClicked(MouseEventme)

当在deleteJList列表框单击选项时,读取选项值赋给deleteWord变量,并去掉其两端空格,向inputDeleteWord输入框输入deleteWord变量值,接着从数据库读取要删除的单词的信息,如某属性不为空,将其输入到eleteWordChinese多行文本框

13)publicvoiddeleteOkButton_actionPerformed(ActionEvente)

单击删除按钮,如果输入框为空,则弹出提示框,否则从数据库中删除要删除的单词的所有记录

14)PublicvoiddeleteCancelButton_actionPerformed(ActionEvente)

单击取消按钮,inputDeleteWord、deleteWordChinese都被清空

15)publicvoidscanButton_actionPerformed(ActionEvente)

单击浏览按钮,scanWordJList列表框被清空,然后从数据库读取所有单词,按升序排列;

然后将所得结果集输入到scanWordJList列表框

16)publicvoidscanWordJList_mouseClicked(MouseEventme)

当鼠标单击scanWordJList列表框时,取所选选项的值赋给变量ndexWord,去掉其两端空格,scanOutput文本框被清空,发音按钮变成灰白色,从数据库读取要查找的单词(indexWord的值),将其音标进行还原,将单词信息输出到scanOutput文本框,如果可以发音,发音按钮变红色,否则indexWord被赋给空值

17)publicvoidsoundButton_actionPerformed(ActionEvente)

 

三、程序模块流程图

开始

英汉互译

是否输入?

是否是英文

查找英文

查找汉译

列出找到的单词

单击?

列出单词信息

清空列表框和

多行文本框

是否找到

显错错误

添加词汇

输入单词?

是否合法

弹出提示信息

是否选择

备选音标

写入音标输入框

单击添加按钮

弹出警告

成功?

显示错误

提示成功

单击取消按钮

清空所有输入框

是否已存在

保存所有信息

不能添加

可否发音

结束

发音按钮变红

Y

N

单击发音

删除词汇

输入?

模糊查找

是否匹配

单击选择?

列出单词信息并把

单词写入输入框

点击删除按钮

是否有单词

删除该单词

点击取消按钮

清空各框内内容

浏览词库

按升序列出词库单词

是否被单击

单击浏览按钮

发音按钮是否红

四、具体程序设计代码

packagelanguanhengdictionary;

importjava.awt.BorderLayout;

importjava.sql.*;

importjava.io.File;

importjava.io.IOException;

importjavax.sound.sampled.AudioSystem;

importjavax.sound.sampled.LineUnavailableException;

importjavax.sound.sampled.UnsupportedAudioFileException;

importjavax.sound.sampled.AudioInputStream;

importjavax.sound.sampled.AudioFormat;

importjavax.sound.sampled.SourceDataLine;

importjavax.sound.sampled.DataLine;

importjavax.swing.JFrame;

importjavax.swing.JTabbedPane;

importjava.awt.Rectangle;

importjavax.swing.JPanel;

importjavax.swing.JLabel;

importjava.awt.Font;

importjava.awt.Color;

importjavax.swing.JTextField;

importjavax.swing.JButton;

importjava.awt.event.ActionEvent;

importjava.awt.event.ActionListener;

importjavax.swing.JTextArea;

importjava.awt.TextArea;

importjava.awt.Dimension;

importjava.awt.Choice;

importjava.awt.event.ItemEvent;

importjava.awt.event.ItemListener;

importjava.awt.Checkbox;

importjavax.swing.JComboBox;

importjavax.swing.JList;

importjavax.swing.JOptionPane;

importjava.awt.*;

importjavax.swing.JScrollPane;

importjava.awt.event.MouseAdapter;

importjava.awt.event.MouseEvent;

importjavax.swing.DefaultListModel;

importjava.awt.event.HierarchyListener;

importjava.awt.event.HierarchyEvent;

importjavax.swing.event.CaretListener;

importjavax.swing.event.CaretEvent;

importjavax.swing.border.TitledBorder;

importjavax.swing.UIManager;

importjavax.swing.BorderFactory;

importjava.io.*;

importjavax.swing.border.Border;

publicclassenglishFrameextendsJFrame{

Connectionconnection=null;

Statementstatement=null;

ResultSetResult=null;

publicenglishFrame(){

try{

jbInit();

}catch(Exceptionexception){

exception.printStackTrace();

}

privatevoidjbInit()throwsException{

getContentPane().setLayout(null);

mainJP.setFont(newjava.awt.Font("

宋体"

Font.PLAIN,25));

mainJP.setForeground(newColor(0,242,118));

mainJP.setBorder(titledBorder1);

mainJP.setToolTipText("

);

mainJP.setBounds(newRectangle(2,51,543,295));

searchEnglishOrChineseJP.setLayout(null);

addWordJP.setLayout(null);

deleteJP.setLayout(null);

scanStock.setLayout(null);

jLabel2.setFont(newjava.awt.Font("

Font.PLAIN,20));

jLabel2.setForeground(newColor(0,180,62));

jLabel2.setText("

输入引擎词"

jLabel2.setBounds(newRectangle(8,16,106,43));

inputSearchWord.setFont(newjava.awt.Font("

jScrollPane1.setBounds(newRectangle(118,60,145,178));

listSearchEnglish.setFont(newjava.awt.Font("

listSearchEnglish.setForeground(Color.blue);

listSearchEnglish.setSelectionBackground(newColor(51,255,104));

outputSearchEnglish.setFont(newjava.awt.Font("

outputSearchEnglish.setBounds(newRectangle(267,59,227,179));

jLabel4.setFont(newjava.awt.Font("

jLabel4.setForeground(newColor(0,180,0));

jLabel4.setText("

新单词"

jLabel4.setBounds(newRectangle(6,9,81,34));

inputNewWord.setFont(newjava.awt.Font("

inputNewWord.setBounds(newRectangle(93,11,155,34));

jLabel5.setFont(newjava.awt.Font("

jLabel5.setForeground(newColor(0,159,14));

jLabel5.setText("

发音"

jLabel5.setBounds(newRectangle(6,118,76,33));

jLabel6.setFont(newjava.awt.Font("

jLabel6.setForeground(newColor(0,173,55));

jLabel6.setText("

词性"

jLabel6.setBounds(newRectangle(7,63,81,35));

pronunciation.setFont(newjava.awt.Font("

ArialUnicodeMS"

Font.PLAIN,20));

pronunciation.setBounds(newRectangle(92,119,154,36));

newWordClass.setBounds(newRectangle(95,62,154,36));

jScrollPane3.setBounds(newRectangle(93,156,154,79));

jLabel7.setFont(newjava.awt.Font("

jLabel7.setForeground(newColor(0,208,48));

jLabel7.setText("

注释"

jLabel7.setBounds(newRectangle(267,9,72,34));

newWordChinese.setFont(newjava.awt.Font("

newWordChinese.setBounds(newRectangle(354,11,164,34));

jLabel8.setFont(newjava.awt.Font("

jLabel8.setForeground(newColor(0,187,0));

jLabel8.setToolTipText("

jLabel8.setText("

过去式"

jLabel8.setBounds(newRectangle(264,62,77,32));

newWordPreterite.setFont(newjava.awt.Font("

newWordPreterite.setBounds(newRectangle(353,61,164,36));

jLabel9.setFont(newjava.awt.Font("

jLabel9.setForeground(newColor(0,187,21));

jLabel9.setText("

现代式"

jLabel9.setBounds(newRectangle(263,122,75,31));

newWordModernism.setFont(newjava.awt.Font("

newWordModernism.setBounds(newRectangle(353,121,163,37));

addOkJButton.setBounds(newRectangle(261,179,83,40));

addOkJButton.setFont(newjava.awt.Font("

addOkJButton.setText("

确定"

add

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试认证 > 交规考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1