欢迎来到天天文库
浏览记录
ID:1656346
大小:129.50 KB
页数:14页
时间:2017-11-12
《哈夫曼编码课程设计java版源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、packagemypackage;importjava.awt.*;importjavax.swing.*;importjavax.swing.event.*;importjava.awt.event.*;importjava.lang.*;importjavax.swing.Box;publicclasshufman{publicstaticvoidmain(String[]args){myFramemy=newmyFrame();}}classmyFrameextendsFrameimplementsActionListene
2、r,Runnable{publicdouble[]frequences=newdouble[50];publicchar[]letters=newchar[50];publicPanelpan=newPanel(newBorderLayout());publicLabelletter=newLabel("输入编码字母:",Label.CENTER);publicLabelfrequence=newLabel("对应频数(以逗号分隔):",Label.CENTER);publicLabelwords=newLabel("输入报文:"
3、,Label.CENTER);publicLabelmawen=newLabel("输入码文:",Label.CENTER);publicLabeltranslatedWords=newLabel("语句:",Label.CENTER);publicTextFieldword=newTextField(12);publicTextFieldinput1=newTextField(12);publicTextFieldinput2=newTextField(12);publicTextFieldinput3=newTextField
4、(12);publicTextFieldinput4=newTextField(12);publicButtoncompel=newButton("画树和编码");publicTextAreacode=newTextArea("",10,3,TextArea.SCROLLBARS_BOTH);publicTextAreatranslation=newTextArea("",10,3,TextArea.SCROLLBARS_BOTH);publicTextFieldtranwords=newTextField(12);publicL
5、abelbrand=newLabel("编码后的码文");publicLabelbras=newLabel("编码情况");publicLabelname=newLabel("码文的翻译");publicButtontrans=newButton("编码语句");publicButtoncontrolTrads=newButton("译码");publicStringyiwen="";publicStringkeyinformation="";publicpaintingpaint=newpainting();publicintl
6、ens;publicStringbianma="";publicThreaddataLine=null;publicListlist=null;publicPanelpanaction=newPanel(newBorderLayout());publicmyFrame(){super();setSize(800,700);this.setTitle("哈夫曼解码/译码器");Fontfont=newFont("",Font.BOLD,20);trans.addActionListener(this);controlTrads.ad
7、dActionListener(this);code.setFont(font);tranwords.setFont(font);translation.setFont(font);input1.setFont(font);input2.setFont(font);word.setFont(font);input3.setFont(font);input4.setFont(font);Boxboxh=Box.createVerticalBox();Boxboxa=Box.createVerticalBox();Boxboxu=Bo
8、x.createHorizontalBox();Boxboxv=Box.createVerticalBox();boxh.add(letter);boxh.add(frequence);boxh.add(words);boxh.add(transl
此文档下载收益归作者所有