打字练习软件源代码.docx

上传人:b****5 文档编号:7680883 上传时间:2023-01-25 格式:DOCX 页数:131 大小:65.75KB
下载 相关 举报
打字练习软件源代码.docx_第1页
第1页 / 共131页
打字练习软件源代码.docx_第2页
第2页 / 共131页
打字练习软件源代码.docx_第3页
第3页 / 共131页
打字练习软件源代码.docx_第4页
第4页 / 共131页
打字练习软件源代码.docx_第5页
第5页 / 共131页
点击查看更多>>
下载资源
资源描述

打字练习软件源代码.docx

《打字练习软件源代码.docx》由会员分享,可在线阅读,更多相关《打字练习软件源代码.docx(131页珍藏版)》请在冰豆网上搜索。

打字练习软件源代码.docx

打字练习软件源代码

打字练习软件源代码

importjavax.swing.*;

importjava.awt.*;

 

/**

*ThiscodewaseditedorgeneratedusingCloudGarden'sJigloo

*SWT/SwingGUIBuilder,whichisfreefornon-commercial

*use.IfJiglooisbeingusedcommercially(ie,byacorporation,

*companyorbusinessforanypurposewhatever)thenyou

*shouldpurchasealicenseforeachdeveloperusingJigloo.

*Pleasevisitfordetails.

*UseofJiglooimpliesacceptanceoftheselicensingterms.

*ACOMMERCIALLICENSEHASNOTBEENPURCHASEDFOR

*THISMACHINE,SOJIGLOOORTHISCODECANNOTBEUSED

*LEGALLYFORANYCORPORATEORCOMMERCIALPURPOSE.

*/

publicclassChatextendsJInternalFrame{

MainFrameparent;

privateJTextPanejtp;

privateJTextFieldtxtData;

publicChat(MainFrameparent){

this.parent=parent;

setLayer(4);

setBounds(1,326,0,0);

this.setPreferredSize(newjava.awt.Dimension(140,223));

((javax.swing.plaf.basic.BasicInternalFrameUI)this.getUI()).setNorthPane(null);

this.putClientProperty("JInternalFrame.isPalette",Boolean.TRUE);

GridBagLayoutthisLayout=newGridBagLayout();

thisLayout.rowWeights=newdouble[]{0.1,0.1,0.0,0.0};

thisLayout.rowHeights=newint[]{7,7,49,56};

thisLayout.columnWeights=newdouble[]{0.0,0.0,0.0,0.0};

thisLayout.columnWidths=newint[]{0,45,45,48};

getContentPane().setLayout(thisLayout);

setVisible(true);

pack();

{

jtp=newJTextPane();

getContentPane().add(jtp,newGridBagConstraints(1,0,4,5,0.0,0.0,GridBagConstraints.NORTH,GridBagConstraints.BOTH,newInsets(0,0,0,0),0,0));

jtp.setPreferredSize(newDimension(140,160));

jtp.setEditable(false);

}

{

txtData=newJTextField();

getContentPane().add(txtData,newGridBagConstraints(1,7,3,1,0.0,0.0,GridBagConstraints.SOUTH,GridBagConstraints.HORIZONTAL,newInsets(0,0,0,0),0,0));

txtData.setColumns(10);

}

}

}

importjava.io.*;

publicclassDistillText{

publicstaticStringgetData(StringfileName,intsegment){

inti=0;

if((fileName==null)||(fileName.length()==0))

return"";

Filef;

FileReaderin=null;

Strings="";

try{

f=newFile(fileName);

in=newFileReader(f);

char[]buffer=newchar[312];

intlen;

if(PublicData.Lang.equals("English")){

if(segment>=(int)(f.length()/312))

PublicData.textTag=0;

}

if(PublicData.Lang.equals("Chinese")){

if(segment>=(int)(f.length()/312-1)+1)

PublicData.textTag=0;

}

while((len=in.read(buffer))!

=-1){

s=newString(buffer,0,len);

i++;

if(i==segment){

PublicData.textTag++;

break;

}

}

}

catch(IOExceptione){

System.out.println(e);

}

finally{

try{

if(in!

=null)

in.close();

}

catch(IOExceptione){}

}

returns;

}

}

importjava.awt.FlowLayout;

importjava.awt.GridBagConstraints;

importjava.awt.GridLayout;

importjava.awt.Insets;

importjava.awt.event.ActionEvent;

importjava.awt.event.ActionListener;

importjavax.swing.text.*;

importjavax.swing.*;

importjava.awt.*;

importjavax.swing.event.*;

publicclassEditorextendsJInternalFrameimplementsDocumentListener,Runnable{

Runtimer=Runtime.getRuntime();

Hintparent;

Documentdoc;

StyledDocumentstyledDoc=newDefaultStyledDocument();

Threadth;

privateinthour=0;//时

privateintminute=0;//分

privateintsecond=0;//秒

privateJLabellblTime;

privateJTextFieldtxtCount;

privateJLabellblError;

privateJCheckBoxon_off_Hint;

privateJButtonbtnRight;

privateJButtonbtnError;

privateJCheckBoxfaze;

privateJCheckBoxgrade;

privateJCheckBoxon_off_Assistant;

privateJPanelpCollocate;

privateJTextPanetxtOriginal;

privateJTextPanetxtNewText;

privateJPanelpShowData;

privateJButtonbtnClose;

privateJLabellblWord;

privateJTextFieldtxtMW;

privateJLabellblM;

privateJTextFieldtxtError;

privateJTextFieldtxtRight;

privateJLabellblRight;

privateJLabellblCount;

privateJTextFieldtxtTime;

privateJPanelpAttrib;

//记录输入的正确和错误的个数据

privateintrightWord=0;

privateinterrorWord=0;

privateintrightCount=0;

privateinterrorCount=0;

privateintwordCount=0;

//临时

privatebooleantemp=true;

publicEditor(Hintparent){

this.parent=parent;

th=newThread(this);

//组建Editor用户界面....

setLayer(4);

setBounds(142,0,0,0);

this.setPreferredSize(newjava.awt.Dimension(657,325));//内部窗体大小

((javax.swing.plaf.basic.BasicInternalFrameUI)this.getUI()).setNorthPane(null);

this.putClientProperty("JInternalFrame.isPalette",Boolean.TRUE);

getContentPane().setLayout(null);

this.setVisible(true);

{

pAttrib=newJPanel();

getContentPane().add(pAttrib,newGridBagConstraints(1,0,12,3,0.0,0.0,GridBagConstraints.NORTH,GridBagConstraints.HORIZONTAL,newInsets(0,0,0,0),0,0));

FlowLayoutpAttribLayout=newFlowLayout();

pAttrib.setBorder(BorderFactory.createTitledBorder(""));

pAttrib.setLayout(pAttribLayout);

pAttrib.setBounds(-2,33,658,42);

{

lblTime=newJLabel();

pAttrib.add(lblTime);

lblTime.setText("\u7528\u65f6:

");

lblTime.setFont(newjava.awt.Font("新宋体",0,12));

}

{

txtTime=newJTextField(8);

pAttrib.add(txtTime);

txtTime.setText("00:

00:

00");

txtTime.setEditable(false);

txtTime.setHorizontalAlignment(SwingConstants.CENTER);

}

{

lblCount=newJLabel();

pAttrib.add(lblCount);

lblCount.setText("\u603b\u5b57\u6570:

");

lblCount.setFont(newjava.awt.Font("新宋体",0,12));

}

{

txtCount=newJTextField();

pAttrib.add(txtCount);

txtCount.setColumns(6);

txtCount.setText("0");

txtCount.setEditable(false);

txtCount.setHorizontalAlignment(SwingConstants.CENTER);

}

{

lblRight=newJLabel();

pAttrib.add(lblRight);

lblRight.setText("\u6b63\u786e:

");

lblRight.setFont(newjava.awt.Font("新宋体",0,12));

}

{

txtRight=newJTextField();

pAttrib.add(txtRight);

txtRight.setColumns(4);

txtRight.setText("0");

txtRight.setEditable(false);

txtRight.setHorizontalAlignment(SwingConstants.CENTER);

}

{

lblError=newJLabel();

pAttrib.add(lblError);

lblError.setText("\u9519\u8bef:

");

lblError.setFont(newjava.awt.Font("新宋体",0,12));

}

{

txtError=newJTextField();

pAttrib.add(txtError);

txtError.setColumns(4);

txtError.setText("0");

txtError.setEditable(false);

txtError.setHorizontalAlignment(SwingConstants.CENTER);

}

{

lblM=newJLabel();

pAttrib.add(lblM);

lblM.setText("\u6bcf\u5206\u949f");

lblM.setFont(newjava.awt.Font("新宋体",0,12));

}

{

txtMW=newJTextField();

pAttrib.add(txtMW);

txtMW.setColumns(4);

txtMW.setText("0");

txtMW.setEditable(false);

txtMW.setHorizontalAlignment(SwingConstants.CENTER);

}

{

lblWord=newJLabel();

pAttrib.add(lblWord);

lblWord.setText("\u4e2a\u5b57");

lblWord.setFont(newjava.awt.Font("新宋体",0,12));

}

{

btnClose=newJButton();

pAttrib.add(btnClose);

btnClose.setText("\u79bb\u5f00");

btnClose.setIcon(newImageIcon(getClass().getClassLoader()

.getResource("Image/leave.gif")));

btnClose.setFont(newjava.awt.Font("新宋体",0,12));

btnClose.addActionListener(newActionListener(){

publicvoidactionPerformed(ActionEventevt){

exitFram();

}

});

}

}

{

pShowData=newJPanel();

getContentPane().add(

pShowData,

newGridBagConstraints(

1,

1,

12,

10,

0.0,

0.0,

GridBagConstraints.CENTER,

GridBagConstraints.BOTH,

newInsets(0,0,0,0),

0,

0));

GridLayoutpShowDataLayout=newGridLayout(2,1);

pShowDataLayout.setHgap(5);

pShowDataLayout.setVgap(5);

pShowDataLayout.setColumns

(1);

pShowDataLayout.setRows

(2);

pShowData.setLayout(pShowDataLayout);

pShowData.setBounds(5,82,644,231);

{

txtOriginal=newJTextPane(styledDoc);

pShowData.add(txtOriginal);

txtOriginal.setPreferredSize(newjava.awt.Dimension(600,0));

txtOriginal.setEditable(false);

}

{

txtNewText=newJTextPane();

pShowData.add(txtNewText);

txtNewText.setPreferredSize(newjava.awt.Dimension(600,0));

Documentdoc=txtNewText.getDocument();

doc.addDocumentListener(this);

}

}

{

pCollocate=newJPanel();

getContentPane().add(

pCollocate,

newGridBagConstraints(

1,

11,

12,

2,

0.0,

0.0,

GridBagConstraints.SOUTH,

GridBagConstraints.BOTH,

newInsets(0,0,0,0),

0,

0));

FlowLayoutpCollocateLayout=newFlowLayout();

pCollocate.setBorder(BorderFactory.createTitledBorder(""));

pCollocate.setLayout(pCollocateLayout);

pCollocate.setBounds(-2,-2,658,35);

{

on_off_Hint=newJCheckBox();

pCollocate.add(on_off_Hint);

on_off_Hint.setText("\u5173\u95ed\u5b57\u6bcd\u63d0\u793a");

on_off_Hint.setSelected(true);

on_off_Hint.setFont(newjava.awt.Font("新宋体",0,12));

}

{

on_off_Assistant=newJCheckBox();

pCollocate.add(on_off_Assistant);

on_off_Assistant.setText("\u5173\u95ed\u6c49\u5b57\u52a9\u624b");

on_off_Assistant.setSelected(true);

on_off_Assistant.setFont(newjava.awt.Font("新宋体",0,12));

}

{

grade=newJCheckBox();

pCollocate.add(grade);

grade.setText("\u79bb\u5f00\u65f6\u662f\u5426\u663e\u793a\u6210\u7ee9");

grade.setSelected(true);

grade.setFont(newjava.awt.Font("新宋体",0,12));

}

{

faze=newJCheckBox();

pCollocate.add(faze);

faze.setText("\u804a\u5929\u7cfb\u7edf\u5f00\u542f\u65f6\u663e\u793a\u81ea\u5df1\u76

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

当前位置:首页 > 自然科学 > 物理

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

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